XXX 플랫폼 전체 아키텍처 설계 어플리케이션 배포

1. 개요


미디어 기구 플랫폼 소프트웨어 목록
 
이름
버전
서버
JDK
1.8.0_육십
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

2. JDK 설치 구성


1. 애플리케이션 계정을 추가하고 계정 전환:

adduserapplication
su -application

2. jdk 압축을 풀고 지정된 위치로 이동합니다.

tarxf jdk-8u60-linux-x64.tar.gz
mvjdk1.8.0_60/ /usr/local/

3. 프로필 파일을 편집하여 적용합니다.

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)

3. Tomcat 설치 구성


1. 애플리케이션 계정을 추가하고 계정 전환:

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. 프로필 파일을 편집하여 적용합니다.

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.xml

 
application@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

4. 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;
        }
 
    }
}

5. 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

6. 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

7. 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

8. SQS 설치 구성


1. AWS 관리 콘솔에 로그인


다음 웹 사이트를 통해 Amazon SQS 콘솔을 엽니다.https://console.aws.amazon.com/sqs/.
 
Create New Queue를 클릭합니다.
Create New Queue 대화 상자의 QueueName 필드에 MyQueue를 입력하고 나머지 필드의 기본값을 유지합니다.
Create Queue를 클릭합니다.
새 대기열이 대기열 목록에 표시됩니다.
Java
실행 예제
SimpleQueue ServiceSample.java를 엽니다.
다음 부분의 코드는 대기열을 만듭니다.
//Create a queue
System.out.println("Creatinga new SQS queue called MyQueue.
"); CreateQueueRequestcreateQueueRequest = newCreateQueueRequest().withQueueName("MyQueue"); StringmyQueueUrl = sqs.createQueue(createQueueRequest).getQueueUrl(); 。 MyQueue 。 C#  Program.cs。 : //Creatinga queue Console.WriteLine("Createa queue called MyQueue.
"); 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

좋은 웹페이지 즐겨찾기