saundy 发表于 2018-11-21 14:05:07

centos7 安装 apache 并做 负载均衡

LoadModule jk_module /etc/httpd/modules/mod_jk.so  
JkWorkersFile /etc/httpd/conf/workers.properties
  
JkMountFile /etc/httpd/conf/uriworkermap.properties
  
JkLogFile /etc/httpd/logs/mod_jk.log
  
JkLogLevel warn
  
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
  
#JkMount /*.* controller
  

  
七、在
  
/etc/httpd/conf/
  
下建立配置workers.properties文件
  
worker.list=controller,status
  

  
worker.tomcat129.port=8009
  
worker.tomcat129.host=192.168.152.129
  
worker.tomcat129.type=ajp13
  
worker.tomcat129.lbfactor=1
  

  
worker.tomcat130.port=8009
  
worker.tomcat130.host=192.168.152.130
  
worker.tomcat130.type=ajp13
  
worker.tomcat130.lbfactor=1
  

  
worker.controller.type=lb
  
worker.controller.balance_workers=tomcat129,tomcat130
  
worker.controller.sticky_session=0
  

  
worker.status.type=status
  

  
八、在
  
/etc/httpd/conf/
  
下建立配置uriworkermap.properties文件
  

  
/*=controller
  
#/jkstatus=status
  
#!/*.gif=controller
  
#!/*.jpg=controller
  
#!/*.png=controller
  
#!/*.css=controller
  
#!/*.js=controller
  
#!/*.htm=controller
  
#!/*.html=controller
  

  

  
负载均衡配置好了
  

  
启动如果报错
  

  
修改httpd.conf文件 找到ServerName添加
  
#ServerName www.example.com:80
  

  
ServerName localhost:80
  

  
剩下session复制了


页: [1]
查看完整版本: centos7 安装 apache 并做 负载均衡