nginx负载均衡postgresql步骤

版权声明:本文为博主原创文章,未经博主允许随便转载,仅作为学习用途 https://blog.csdn.net/qq_39424981/article/details/79387580
1.

安装之前的准备

安装gcc

sudo apt-get  build-dep  gcc 

安装openssl1.1.0e

wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz

安装pcre8.40

wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz

安装zlib1.2.11

wget https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz

2

安装

Nginx1.13.7

wget http://nginx.org/download/nginx-1.13.7.tar.gz

执行下面命令进行编译

./configure --prefix=/usr/local/nginx --with-stream --with-stream_ssl_module \

--sbin-path=/home/nginx/nginx \

--conf-path=/home/nginx/nginx.conf \

--pid-path=/home/nginx/nginx.pid \

--with-http_ssl_module \

--with-pcre=/home/pcre-8.40 \

--with-zlib=/home/zlib-1.2.11 \

--with-openssl=/home/openssl-1.1.0e


安装注意事项

stream模块默认没有编译到nginx, 编译nginx时候 ./configure –with-stream 即可


3.

stream{
  upstream pg{
    server  192.168.0.184:5432;
    server  192.168.0.185:5432;
   }
server{
    listen 1111;
    proxy_pass pg;
   }

}

4.

通过虚拟机部署三台Linux服务,post1部署nginx环境,在postgres1postgres2部署postgres-xl,实现post1负载postgres1postgres2


猜你喜欢

转载自blog.csdn.net/qq_39424981/article/details/79387580
今日推荐