一、概览
传媒机构平台软件列表
名称 |
版本 |
服务器 |
JDK |
1.8.0_60 |
transaction-server/trade-server/transaction-app/memberapp/designapp-WebAPI/designapp-SystemAPI/dispatch/Merchant/comment-server/materials-admin-app/materials-contract-server/materials-recommend-app/SearchEngine/sso/alipay |
Tomcat |
apache-tomcat-8.0.26 |
同上 |
Nginx |
nginx/1.8.1 |
Pugongying/Pugongying-Adm |
zookeeper |
zookeeper-3.3.6 |
Zookeeper |
dubbo-admin |
dubbo-admin-2.5.4 |
Dubbo-admin |
dubbo-monitor |
dubbo-monitor-simple-2.5.3 |
Dubbo-monitor |
SQS |
pugongying-Prod |
https://sqs.cn-north-1.amazonaws.com.cn/950338194542/pugongying-Prod |
二、JDK安装配置
1、增加application账号并进行账号切换:
adduserapplication su -application
2、解压jdk并移动到指定位置:
tarxf jdk-8u60-linux-x64.tar.gz mvjdk1.8.0_60/ /usr/local/
3、编辑profile文件并使之生效:
vim /etc/profile >-------------------------------- exportJAVA_HOME=/usr/local/jdk1.8.0_60 exportJRE_HOME=${JAVA_HOME}/jre exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib exportPATH=${JAVA_HOME}/bin:$PATH source /etc/profile
4、验证:
application@xxxxx:~$ java -version javaversion "1.8.0_60" Java(TM)SE Runtime Environment (build 1.8.0_60-b27) JavaHotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
三、Tomcat安装配置
1、增加application账号并进行账号切换:
adduserapplication su -application
2、解压apache-tomcat到指定位置并赋权:
unzip apache-tomcat-8.0.26.zip -d /opt/tomcat/apache-tomcat-8.0.26 chown-R application.application /opt/tomcat/ chmod-R +x /opt/tomcat/apache-tomcat-8.0.26/bin
3、编辑profile文件并使之生效:
vim /etc/profile >-------------------------------- exportCATALINA_BASE=/opt/tomcat/apache-tomcat-8.0.26 exportCATALINA_HOME=/opt/tomcat/apache-tomcat-8.0.26 exportCATALINA_TMPDIR=/opt/tomcat/apache-tomcat-8.0.26/temp exportJRE_HOME=$JAVA_HOME exportCLASSPATH=/opt/tomcat/apache-tomcat-8.0.26/bin/bootstrap.jar source /etc/profile
4、启动服务并验证:
application@xxxxxx:~$/opt/tomcat/apache-tomcat-8.0.26/bin/startup.sh application@xxxxxx:~$netstat -lntp|grep 8080 (Notall processes could be identified, non-owned process info will not be shown, you would have to be rootto see it all.) tcp6 0 0 :::8080 :::* LISTEN 5957/java application@xxxxxx:~$ps -ef|grep tomcat applica+ 2639 1913 0 02:21 pts/0 00:00:00 grep --color=auto tomcat applica+ 5957 1 0 Sep28 ? 00:55:40/usr/local/jdk/jdk1.8.0_60/bin/java -Dnop-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server-Dfile.encoding=UTF-8 -Xms1024m -Xmx3072m -XX:NewRatio=4 -XX:+AggressiveOpts-XX:+HeapDumpOnOutOfMemoryError-XX:HeapDumpPath=/opt/tomcat/apache-tomcat-8.0.26/logs -XX:+PrintGCDetails-XX:+PrintGCDateStamps -XX:+UseG1GC-Xloggc:/opt/tomcat/apache-tomcat-8.0.26/logs/gc.log-Djava.endorsed.dirs=/opt/tomcat/apache-tomcat-8.0.26/endorsed -classpath.:/usr/local/jdk/jdk1.8.0_60/lib/dt.jar:/usr/local/jdk/jdk1.8.0_60/lib/tools.jar:/opt/tomcat/apache-tomcat-8.0.26/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.26/bin/tomcat-juli.jar-Dcatalina.base=/opt/tomcat/apache-tomcat-8.0.26-Dcatalina.home=/opt/tomcat/apache-tomcat-8.0.26-Djava.io.tmpdir=/opt/tomcat/apache-tomcat-8.0.26/temporg.apache.catalina.startup.Bootstrap start
5、调优:
application@xxxx:/opt/tomcat/apache-tomcat-8.0.26/conf$more server.xmlapplication@xxxx:/opt/tomcat/apache-tomcat-8.0.26/bin$more setenv.sh exportJAVA_OPTS="-server -Dfile.encoding=UTF-8 -Xms1024m -Xmx2048m-XX:NewRatio=4 -XX:+AggressiveOpts -XX:+HeapDumpOnOutOfMemoryError-XX:HeapDumpP ath=$CATALINA_HOME/logs-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseG1GC-Xloggc:$CATALINA_BASE/logs/gc.log"
6、日志:
application@xxxx:/opt/tomcat/apache-tomcat-8.0.26/conf$more server.xml
四、Nginx安装配置
1、安装依赖包:
apt-getinstall openssl libssl-dev libperl-dev apt-getinstall libpcre3 libpcre3-dev apt-getinstall make
2、解压nginx到指定位置并编译安装:
tarxf nginx-1.8.1.tar.gz –c /opt/nginx220/ cdnginx-1.8.1/ groupaddapplication useradd-d /home/application -g application -m application ./configure--prefix=/usr/local/nginx --without-http_memcached_module --user=application--group=application --with-http_stub_status_module --with-pcre--with-http_ssl_module
3、启动并验证:
root@xxxxxx:~# ps -ef|grep nginx root 26481 26465 0 02:48 pts/9 00:00:00 grep --color=auto nginx root 38244 1 0 Oct12 ? 00:00:00 nginx: master process/opt/nginx220/sbin/nginx -c /opt/nginx220/conf/nginx.conf nobody 38245 38244 0 Oct12 ? 00:00:24 nginx:worker process nobody 38246 38244 0 Oct12 ? 00:00:25 nginx:worker process root@xxxxxx:~# netstat -lntp|grep 80 tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 38244/nginx.conf
4、配置:
root@xxxxxx:/opt/nginx220/conf# morenginx.conf
#user nobody; worker_processes 2; events{ worker_connections 5120; } http{ server_tokens off; include mime.types; default_type application/octet-stream; # proxy_set_header Host www.pugongying.com; log_format main '$remote_addr - $remote_user[$time_local] "$request" ' '$status $body_bytes_sent"$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"' '"$cookie_JSESSIONID"'; access_log logs/access.log main;
sendfile on; tcp_nopush on; tcp_nodelay on; # keepalive_timeout 65; client_header_timeout 10m; client_body_timeout 10m; client_max_body_size 1000m; send_timeout 10m; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; proxy_buffer_size 4k; proxy_buffers 32 4k; proxy_busy_buffers_size 64k; proxy_set_header Host $host; proxy_set_header Remote_Addr $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Cookie $http_cookie; # ignore_invalid_headers off; gzip on; gzip_min_length 1k; gzip_buffers 16 64k; gzip_http_version 1.1; gzip_comp_level 6; gzip_types text/plainapplication/x-javascript text/css application/xml application/javascriptapplication/json; gzip_vary on;
upstream pugongying { #server internal-Pugongying-1a-Pugongying-1116519323.cn-north-1.elb.amazonaws.com.cn:8080; ip_hash; server 10.0.13.67:8080 max_fails=3 fail_timeout=30s; server 10.0.13.66:8080 max_fails=3 fail_timeout=30s; } upstream sso { #server internal-Pugongying-1a-SSO-1865196471.cn-north-1.elb.amazonaws.com.cn:8080; ip_hash; server 10.0.13.244:8080 max_fails=3 fail_timeout=30s; server 10.0.13.203:8080 max_fails=3 fail_timeout=30s; } upstream memberApp { #server internal-Pugongying-1a-member-app-666695519.cn-north-1.elb.amazonaws.com.cn:8080; ip_hash; server 10.0.14.47:8080 max_fails=3 fail_timeout=30s; server 10.0.14.46:8080 max_fails=3 fail_timeout=30s; }
upstream transactionApp { #server internal-Pugongying-1a-transaction-app-52068785.cn-north-1.elb.amazonaws.com.cn:8080; ip_hash; server 10.0.14.112:8080 max_fails=3 fail_timeout=30s; server 10.0.14.110:8080 max_fails=3 fail_timeout=30s; } upstream designApp { #server internal-Pugongying-1a-designapp-WebAPI-932998549.cn-north-1.elb.amazonaws.com.cn:8080; ip_hash; server 10.0.14.109:8080 max_fails=3 fail_timeout=30s; server 10.0.14.108:8080 max_fails=3 fail_timeout=30s; }
upstream cp-search-server { #server internal-Pugongying-Search-Engine-1939320274.cn-north-1.elb.amazonaws.com.cn:8080; ip_hash; server 10.0.14.238:8080 max_fails=3 fail_timeout=30s; server 10.0.14.239:8080 max_fails=3 fail_timeout=30s; } server { listen 8080; server_name *.pugongying.com; add_header X-Host "1a-ubt-1"; port_in_redirect off; location /pugongying/ { proxy_passhttp://pugongying/pugongying/; if ($uri = "/pugongying/ads" ){ rewrite ^(.*)$ http://www.pugongying.com/pugongying/ads/break; } }
location /sso/ { proxy_pass http://sso/sso/; proxy_cookie_path /sso/ /; } location /alipay/ { proxy_pass http://sso/alipay/; } location /member-app/ { proxy_pass http://memberApp/member-app/; } location /transaction-app/ { proxy_passhttp://transactionApp/transaction-app/; }
location /cp-search-server/ { proxy_passhttp://cp-search-server/cp-search-server/; } location /design-app/ { proxy_passhttp://designApp/design-app/; } location / { rewrite ^(.*)$ /pugongying/$1last; } location /status { stub_status on; # access_log off; # allow all; }
error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
五、Zookeeper安装配置
1、下载并解压zookeeper到指定位置:
wge thttp://www.apache.org/dist/zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz tar zxvf zookeeper-3.3.6.tar.gz cd zookeeper-3.3.6 cp conf/zoo_sample.cfg conf/zoo.cfg
2、配置:
application@Pugongying-1a-Zookeeper-Ubt-1:~$more /opt/zookeeper/zookeeper-3.3.6/conf/zoo.cfg #The number of milliseconds of each tick tickTime=2000 #The number of ticks that the initial #synchronization phase can take initLimit=10 #The number of ticks that can pass between #sending a request and getting an acknowledgement syncLimit=5 #the directory where the snapshot is stored. dataDir=/home/admin/zookeeper/Data #the port at which the clients will connect clientPort=2181 #ForZookeeper Cluster 1a server.1=Pugongying-1a-Zookeeper-Ubt-1:2881:3881 server.2=Pugongying-1a-Zookeeper-Ubt-2:2882:3882 server.3=Pugongying-1a-Zookeeper-Ubt-3:2883:3883
3、zookeeper启停:
application@xxxx:/opt/zookeeper/zookeeper-3.3.6/$ 启动: ./bin/zkServer.shstart 停止: ./bin/zkServer.shstop
4、验证:
application@xxxx:~$ netstat -lntp|grep2181 (Notall processes could be identified, non-owned process info will not be shown, you would have to be rootto see it all.) tcp6 0 0 :::2181 :::* LISTEN 9963/java application@xxxx:~$ ps -ef|grep zookeeper applica+ 9963 1 0 May24 ? 02:42:22 /usr/local/jdk/jdk1.8.0_60/bin/java-Dzookeeper.log.dir=/home/admin/zookeeper/logs-Dzookeeper.root.logger=INFO,ROLLINGFILE -cp/opt/zookeeper/zookeeper-3.3.6/bin/../build/classes:/opt/zookeeper/zookeeper-3.3.6/bin/../build/lib/*.jar:/opt/zookeeper/zookeeper-3.3.6/bin/../zookeeper-3.3.6.jar:/opt/zookeeper/zookeeper-3.3.6/bin/../lib/log4j-1.2.15.jar:/opt/zookeeper/zookeeper-3.3.6/bin/../lib/jline-0.9.94.jar:/opt/zookeeper/zookeeper-3.3.6/bin/../src/java/lib/*.jar:/opt/zookeeper/zookeeper-3.3.6/bin/../conf:.:/usr/local/jdk/jdk1.8.0_60/lib/dt.jar:/usr/local/jdk/jdk1.8.0_60/lib/tools.jar-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=falseorg.apache.zookeeper.server.quorum.QuorumPeerMain/opt/zookeeper/zookeeper-3.3.6/bin/../conf/zoo.cfg applica+31045 30961 0 03:03 pts/0 00:00:00 grep --color=auto zookeeper
六、Dubbo-admin安装配置
1、安装jdk&&tomcat环境:
wget http://apache.etoak.com/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz tar zxvf apache-tomcat-6.0.35.tar.gz cd apache-tomcat-6.0.35 rm -rfwebapps/ROOT
2、解压dubbo-admin到指定位置并配置zookeeper:
unzip dubbo-admin-2.5.4-SNAPSHOT.war -d webapps/ROOT 配置: application@Pugongying-1a-Dubbo-Admin-Ubt:/opt/tomcat/apache-tomcat-6.0.37/webapps/ROOT/WEB-INF$more dubbo.properties dubbo.registry.address=zookeeper://Pugongying-1a-Zookeeper-Ubt-1:2181?backup=Pugongying-1a-Zookeeper-Ubt-2:2181,Pugongying-1a-Zookeeper-Ubt-3:2181 dubbo.admin.root.password=xxxx dubbo.admin.guest.password=xxxx
3、服务启停:
启动: ./bin/startup.sh 停止: ./bin/shutdown.sh
七、Dubbo-monitor安装配置
1、解压dubbo-monitor到指定位置并进行配置修改:
tar zxvf dubbo-monitor-simple-2.5.4-SNAPSHOT-assembly.tar cd dubbo-monitor-simple-2.5.4-SNAPSHOT
2、配置:
application@xxxx:~$ more/opt/dubbo-monitor/dubbo-monitor-simple-2.5.3/conf/dubbo.properties dubbo.container=log4j,spring,registry,jetty dubbo.application.name=simple-monitor dubbo.application.owner= dubbo.registry.address=zookeeper://Pugongying-1a-Zookeeper-Ubt-1:2181?backup=Pugongying-1a-Zookeeper-Ubt-2:2181,Pugongying-1a-Zookeeper-Ubt-3:2181 dubbo.protocol.port=7070 dubbo.jetty.port=8080 dubbo.jetty.directory=${user.home}/monitor dubbo.charts.directory=${dubbo.jetty.directory}/charts dubbo.statistics.directory=${user.home}/monitor/statistics dubbo.log4j.file=logs/dubbo-monitor-simple.log #dubbo.log4j.level=WARN dubbo.log4j.level=INFO
3、服务启停:
启动、停止命令: 启动: ./bin/start.sh 停止: ./bin/stop.sh
八、SQS安装配置
1、登录AWS 管理控制台
并通过以下网址打开 Amazon SQS 控制台:https://console.aws.amazon.com/sqs/。
单击“Create New Queue”。
在 Create New Queue 对话框的 QueueName 字段中输入 MyQueue,并保留其余字段的默认值设置。
单击“Create Queue”。
您的新队列显示在队列列表中。
Java
如需运行示例
打开“SimpleQueueServiceSample.java”。
以下部分的代码创建队列:
//Create a queue System.out.println("Creatinga new SQS queue called MyQueue.\n"); CreateQueueRequestcreateQueueRequest = newCreateQueueRequest().withQueueName("MyQueue"); StringmyQueueUrl = sqs.createQueue(createQueueRequest).getQueueUrl(); 编译并运行示例。 MyQueue队列已创建。 C# 如需运行示例 打开 Program.cs。 以下部分的代码创建队列: //Creatinga queue Console.WriteLine("Createa queue called MyQueue.\n"); CreateQueueRequestsqsRequest = new CreateQueueRequest(); sqsRequest.QueueName= "MyQueue"; CreateQueueResponsecreateQueueResponse = sqs.CreateQueue(sqsRequest); StringmyQueueUrl; myQueueUrl= createQueueResponse.QueueUrl; 运行示例。 MyQueue队列已创建。
2、pugongying-Prod:
名称: pugongying-Prod 默认可见性超时 30 秒钟 URL: https://sqs.cn-north-1.amazonaws.com.cn/950338194542/pugongying-Prod 消息保留周期 4 天 ARN: arn:aws-cn:sqs:cn-north-1:950338194542:pugongying-Prod 最大消息大小 256 KB 已创建: 2016-09-14 16:30:01GMT+08:00 接收消息等待时间 0 秒钟 上次更新: 2016-09-14 16:40:24GMT+08:00 可用消息(可见): 0 交付延迟 0 秒钟 传输中的消息(不可见): 0 延迟的消息: 0