源码部署及编译1.将openfire源码解压2.将解压后的源码拷贝到Eclipse的工作空间中3.把源码openfire_src文件中build中有个eclipse文件夹,一个settings文件夹和classpath,project两个文件,将他们都复制到和build同级,并从其他项目中拷“.classpath和.project,这两个文件,都是带点的!然后将eclipse文件夹中拷贝出来classpath,project两个文件中内容分别替换掉对应.classpath,.project中的内容,就可以把classpath,project两个文件删除掉了。4.在Eclipse中导入openfire_src工程此时,会有这样的错误:这是由于缺少jar包引起的:将移除,在build的lib中,将没有buildpath的jar包AddToBuildPath5.完成上部操作后,会有下面的错误:添加jar包,AddToBuildPath此时会有下面的错误实现借口中的方法即可将build—lib下的jar包buildpath6.编译7.运行选中项目,右键—RunAs—RunConfiguratios点击Search,输入ServerStarter选中Arguments选项卡,在VMarguments中填入-DopenfireHome=${workspace_loc:openfire_src}/target/openfire****千万注意DopenfireHome前面有个“-”选中Classpath选项卡,选中UserEntries,点击右边的Advanced按钮选择AddFolder添加src/i18n确定选择AddFolder添加resources/i18n确定选择右侧的Advanced…–选择AddFolderbuild/lib/dist确定选择右侧的Advanced…–选择AddFoldersrc/resources/jar确定点击Apply,Run集群说明:如果使用源码做集群,则需要将src/plugins/clustering/src/java整个包删除,否则与hazelcast有冲突1.所有集群的域必须相同2.安装HazelcastClusteringPlugin3.进入plugins—hazelcast—classes打开hazelcast-cache-config.xml文件,修改network下的代码为:portauto-increment=true5701/portjoinmulticastenabled=false/tcp-ipenabled=truemember192.168.1.5/membermember192.168.1.16/membermember192.168.1.17/member/tcp-ipawsenabled=false//join或者:joinmulticastenabled=false/tcp-ipenabled=truemember192.168.1.5:5701/membermember192.168.1.16:5701/membermember192.168.1.17:5701/member/tcp-ipawsenabled=false//join4.重启服务器,点击Clustering查看集群中的节点重置openfire:将conf下的openfire.xml文件中的setuptrue/setup删掉,重新进入进行配置即可Nginx负载均衡首先将pcre-8.34.tar.gz、zlib-1.2.8.tar.gz、nginx-1.7.3.tar.gz、nginx_tcp_proxy_module-master.zip上传到linux系统中安装make:yum–yinstallgccautomakeautoconflibtoolmake安装g++:yuminstallgccgcc-c++安装pcre库将下载的pcre库解压,移动到usr/local/src目录中(这个目录可以随便指定)cdpcre-8.34./configuremakemakeinstall安装zlib库将下载的zlib库解压,移动到usr/local/src目录中(这个目录可以随便指定)cdzlib-1.2.8./configuremakemakeinstall安装openssl:yum–yinstallopensslopenssl-develnginx默认只支持http负载均衡,为了让nginx支持tcp负载均衡,还需要这个项目。将nginx_tcp_proxy_module-master.zip解压:unzipnginx_tcp_proxy_module-master.zip将解压出的文件夹nginx_tcp_proxy_module-master移动到nginx-1.7.3中[root@localhostnginx-1.7.3]#patch-p1nginx_tcp_proxy_module-master/tcp.patch[root@localhostnginx-1.7.3]#./configure--add-module=nginx_tcp_proxy_module-master编辑nginx.conf,配置如下:#usernobody;worker_processes1;#error_loglogs/error.log;#error_loglogs/error.lognotice;#error_loglogs/error.loginfo;#pidlogs/nginx.pid;events{worker_connections1024;}tcp{timeout1d;proxy_read_timeout10d;proxy_send_timeout10d;proxy_connect_timeout30;upstreamopenfire5222{server192.168.1.6:5222;server192.168.1.22:5222;server192.168.1.23:5222;}server{listen5222;proxy_passopenfire5222;so_keepaliveon;tcp_nodelayon;}upstreamopenfire5223{server192.168.1.6:5223;server192.168.1.22:5223;server192.168.1.23:5223;}server{listen5223;proxy_passopenfire5223;so_keepaliveon;tcp_nodelayon;}}http{includemime.types;default_typeapplication/octet-stream;#log_formatmain'$remote_addr-$remote_user[$time_local]$request'#'$status$body_bytes_sent$http_referer'#'$http_user_agent$http_x_forwarded_for';#access_loglogs/access.logmain;sendfileon;#tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;#gzipon;upstreamopenfire7070{server192.168.1.6:7070;server192.168.1.22:7070;server192.168.1.23:7070;}server{listen7070;server_namelocalhost;location/{proxy_pass}}upstreamopenfire9090{server192.168.1.6:9090;server192.168.1.22:9090;server192.168.1.23:9090;ip_hash;}server{listen9090;server_namelocalhost;location/{proxy_pass}}server{listen80;server_namelocalhost;#charsetkoi8-r;#access_loglogs/host.access.logmain;location/{roothtml;indexindex.htmlindex.htm;}location/status{tcp_check_status;}#error_page404/404.html;#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}#proxythePHPscriptstoApachelisteningon127.0.0.1:80##location~\.php${#proxy_pass}#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000##location~\.php${#roothtml;#fastcgi_pass127.0.0.1:9000;#fastcgi_indexindex.php;#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;#includefastcgi_params;#}#denyaccessto.htaccessfiles,ifApache'sdocumentroot#concurswithnginx'sone##location~/\.ht{#denyall;#}}#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration##server{#listen8000;#listensomename:8080;#server_namesomenamealiasanother.alias;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}#HTTPSserver##server{#listen443;#server_namelocalhost;#sslon;#ssl_certificatecert.pem;#ssl_certificate_keycert.key;#ssl_session_timeout5m;#ssl_protocolsSSLv2SSLv3TLSv1;#ssl_ciphersHIGH:!aNULL:!MD5;#ssl_prefer_server_cipherson;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}}关闭防火墙:重启后生效:chkconfigiptablesonchkconfigiptablesoff即时生效:serviceiptablesstartserviceiptablesstopnginx开机启动:首先,在linux系统的/etc/init.d/目录下创建nginx文件,使用如下命令:vi/etc/init.d/nginx在脚本中添加如下命令:*************************