首页 > 编程知识 正文

ssh 反向代理,ssh隧道反向代理实例

时间:2023-05-05 18:50:10 阅读:150089 作者:829

ZooKeeper :Nginx基于TCP协议代理ZooKeeper群集。 在之前的博客中,博客主介绍了如何构建ZooKeeper集群:

zookeeper :构建zookeeper集群构建zookeeper集群是为了使用它。 以前博主也介绍了Nacos集群的构建方法,使用了Nginx作为Nacos集群的代理。 如果客户端希望请求Nacos群集的服务,则只需与其Nginx交互即可(Nginx将请求转发到Nacos群集,Nacos群集响应,Nginx也响应客户端),真正的Nacos群集通过外部网络进行交互内部网络下的Nacos群集更安全,但Nginx是基于HTTP协议代理的Nacos群集。 因为客户端和Nacos群集是使用rest风格的API进行的,ZooKeeper客户端和服务端建立了TCP长连接,显然基于TCP协议,所以将Nginx代理ZooKeeper群集

springcloudalibaba :构建nacos群集Nginx并添加TCP连接代理模块Nginx要基于TCP协议代理ZooKeeper群集,请执行以下操作Nginx的方便之处在于Nginx的

分布式编辑- Nginx添加SSL以允许HTTPS访问ngx_stream_core_module模块。 从1.9.0版开始可用,但缺省情况下未生成此模块,并且在配置Nginx时通过--with-stream参数启用。

我们已经讨论了Nginx的安装,此处不再赘述,但必须在运行./configure命令时添加--with-stream参数。 这允许Nginx生成ngx_stream_core_module模块,然后Nginx根据TCP协议代理zookeeeeam

分布式编辑- Nginx安装和运行配置

./configure-- with-stream [ root @ localhost nginx-1.20.2 ] #./configure-- with-streamcheckingforoslinux3. checking for gcc-pipe switch . found . checkingforgccbuiltin 64 bitbyteswap . foundconfigurationsummaryusingsystempcrelibralibrap zliblibrarynginxpathprefix : '/usr/local/nginx ' nginx binary file 3360 '/usr/local/nginx ' nginx binary file 3360 ' nginx nginx ' nginxmodulespath : '/usr/local/nginx/modules ' nginxconfigurationprefix 3360 '/usr/local/nginx/nginx.conf ' nginx pidfile : '/usr/local/nginx/logs/nginx.PID ' nginxerrorlogfile 3360 error.log ' nginxhttttttpacacal access.log ' nginxhttpclientrequestbodytemporaryfiles 3360 ' client _ body _ temp ' nginxhttpproxytemporaryfiles 3360 ' proxytes httpuwsgitemporaryfiles 3360 ' uw SGI _ temp ' nginxhttpscgitemporaryfiles 3360

生成安装

编译、安装

[ root @ localhost/] # CD/usr/local/nginx/conf [ root @ localhost conf ] # ll总用量68-rw-r----r----1rootroot107711月19日17336019 fastcgi.conf-rw-r---1 root root 107711月19日1917336019 fass ----r----1rootroot100711月19日17336019 fastcgi _ params.default-rw-r-6019 koi-utf-rw-r---r-1 日17336019mime.1 1月19日17336019 mime.types.default-rw-r-- r--1root root 265611月19日17336019 nginx.conf-rw-rw 月19日17336019 scgi _ params-rw-r---1 root root 63611月19日17:19scgi_parami 11月19日17336019 uw SGI _ params-rw-r

流{服务器{ listen 9999; proxy_pass zookeeper; } upstream zookeeper { server 192.168.1.19933609000; server 192.168.1.200:9000; server 192.168.1.201:9000; }} ./nginx启动nginx。/nginx -t检查nginx配置文件是否满足要求。 /nginx -s stop此方法等效于检测nginx进程id,然后使用kill命令强制杀死进程。/nginx -s quit此方法在nginx进程处理任务后停止nginx。/nginx -重新启动sreloadnginx。 检查配置是否有问题:

./nginx -t

启动Nginx :

./nginx关闭防火墙(命令可能因操作系统而异。 自驾游百度) :

systemctl stop firewalld Nginx成功启动(ZooKeeper群集节点2 ) :

启动ZooKeeper群集后,可以通过Nginx请求ZooKeeper群集的服务。

如果有Mode参数询问ZooKeeper群集节点的状态,则表示ZooKeeper群集已成功引导。

这里需要准备好本地客户端(Windows版、ZooKeeper文件)。 当然,也可以在ZooKeeper群集中的任何节点上使用客户端进行测试)连接到Nginx。

ZK CLI.cmd-time out 5000-server 192.168.1.20033609999

ZooKeeper :重要概念客户端命令的介绍表明,Nginx通过基于TCP协议代理ZooKeeper群集获得了成功。 如果博主说错了话,或者大家有不同的见解,我们欢迎发表评论。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。