logo资料库

财华社项目部署安装文档.docx

第1页 / 共48页
第2页 / 共48页
第3页 / 共48页
第4页 / 共48页
第5页 / 共48页
第6页 / 共48页
第7页 / 共48页
第8页 / 共48页
资料共48页,剩余部分请下载后查看
安装libfatscommon
安装FastDFS
财华社安装文档(第二版) 本安装文档基于下面的架构图 192.168.80.37 LVS+Keepalived 192.168.80.38 LVS+Keepalived 192.168.80.31 Nginx+Tomcat+FastDFS+Redis+JDK1.7 192.168.80.32 Nginx+Tomcat+FastDFS+Redis+JDK1.7 192.168.80.33 Nginx+Tomcat+FastDFS+Redis+JDK1.7 192.168.80.34 Mysql Cluster+Redis 192.168.80.35 Mysql Cluster+Redis 192.168.80.36 Mysql Cluster+Redis 192.168.80.30 业务层 VIP 192.168.80.39 RDB VIP 192.168.80.40 NoSQL VIP
本文以 yum 為例 说明 以下命令皆以#开头,如果报错,有可能是 word 粘贴的问题, 手打一遍命令试试看,如果还不行,联系我 微信号 fyp19890901 lvs+keepalived+nginx 负载搭建 LVS:(Linux virtual server)是一款网络模型四层的负载软件,即 IP+端口的转发模 式, LVS:提供三种负载方式: VS/NAT:网络地址转化 VS/TUN:端 VS/DR:直接轮询模式 10 种调度算法:常用的由一下几种: rr:轮叫调度,不管每个服务器的实际情况 wrr :加权轮叫调度。 lc:最少链接调度 wlc:加权最少链接调度 操作系统:centOS6.5 Lvs 主调度器:192.168.80.37
备调度器:192.168.80.38 VIP:192.168.80.30 Real Server:192.168.80.31 Real Server:192.168.80.32 Real Server:192.168.80.33 LVS 主备上面,配置 linux 系统内核参数开启内核的路由模式 # vi /etc/sysctl.conf net.ipv4.ip.forward = 1 所有服务器先暂时关闭 iptables 服务,避免影响服务搭建。 在主备服务器上安装 LVS version 1.26 选择 yum 或源码包的安装方式 # yum install ipvsadm
以下是源码安装 # wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz # tar –zxvf ipvsadm-1.26.tar.gz # make && make install keepalived 安装环境 yum -y install gcc gcc-c++ openssl-devel libnl libnl-devel libnfnetlink-devel popt-devel Tomcat 安装环境 yum -y install perl 5 yum install expat-devel Openssl 版本低需执行以下命令 1、查看源版本 # openssl version -a OpenSSL 1.0.1e 2、下载 openssl-1.0.2h.tar.gz # wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz 3、更新 zlib # yum -y install zlib 4、解压安装 # tar -zxf openssl-1.0.2h.tar.gz # cd openssl-1.0.2h # ./config shared zlib &&make&&make install # mv /usr/bin/openssl /usr/bin/openssl.bak # mv /usr/include/openssl /usr/include/openssl.bak
# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl # ln -s /usr/local/ssl/include/openssl /usr/include/openssl # echo "/usr/local/ssl/lib" >> /etc/ld.so.conf # ldconfig -v 5、查看是否升级成功 [root@zj ~]# openssl version -a 在主备服务器安装 keepalived version 1.2.4 Wget 找不到的话 # yum -y install wget 我有个习惯要下载的东西我会放到/home 下 # cd /home # wget http://www.keepalived.org/software/keepalived-1.2.4.tar.gz # tar -zxvf keepalived-1.2.4.tar.gz # cd keepalived-1.2.4 # ./configure -prefix=/usr/local/keepalived # make && make install 将 keepalived 做成开启启动服务 # cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/ # cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/ # mkdir /etc/keepalived # cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/ # cp /usr/local/keepalived/sbin/keepalived /usr/sbin/ 在主备配置 keepalived.conf 主 LVS 上面的 keepalived 的配置文件 #vim /etc/keepalived/keepalived.conf 主机 192.168.80.37 ! Configuration File for keepalived global_defs { notification_email { } router_id LVS_MASTER } vrrp_instance VI_1 { state MASTER
interface eth0 virtual_router_id 51 priority 150 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.80.30 } } vrrp_server 192.168.80.30 80 { delay_loop 3 lb_algo wrr lb_kind DR persistence_timeout 30 protocol TCP real_server 192.168.80.30 80 { weight 3 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.80.30 80 { weight 3 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } } 从机 192.168.80.38
! Configuration File for keepalived global_defs { notification_email { } router_id LVS_BACKUP } vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.80.30 } } vrrp_server 192.168.80.30 80 { delay_loop 3 lb_algo wrr lb_kind DR persistence_timeout 30 protocol TCP real_server 192.168.80.30 80 { weight 3 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 80 } } real_server 192.168.80.30 80 { weight 3 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 connect_port 80
} } } 3 台 Nginx version 1.12.1 192.168.80.31 192.168.80.32 192.168.80.33 安装过程 参照 FastDFS 部分的 Nginx 安装过程,需要添加模块 负载均衡 将下列几行配置添加到 37 38 两台 # vi /etc/sysconfig/ipvsadm -A -t 192.168.80.30:80 -s wrr -a -t 192.168.80.30:80 -r 192.168.80.31:80 -g -w 3 -a -t 192.168.80.30:80 -r 192.168.80.32:80 -g -w 3 -a -t 192.168.80.30:80 -r 192.168.80.33:80 -g -w 3 # service ipvsadm reload 将上面的配置保存进配置文件 ##### -g 表示直接路由,-w 表示权重的值 禁止 arp 相应的请求 192.168.80.31 32 33 37 38 这 5 台都要配置 # vi /etc/sysctl.conf 放在文件的最后 net.ipv4.conf.lo.arp_ignore = 1 net.ipv4.conf.all.arp_ignore = 1
分享到:
收藏