爱你定操作文档

2020-07-15  本文已影响0人  ArthurIsUsed

Install JDK1.8 on server 39.96.20.193 && 39.96.29.113

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

Install mysql5.7 on server 39.96.29.113

https://app.yinxiang.com/shard/s15/nl/18441312/c8bd4a19-320c-4447-944d-2eecb631d4a8?title=Install%20mysql5.7%20by%20compiling%20source%20code%20on%20%20Centos

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
  -DDEFAULT_CHARSET=utf8 \
  -DDEFAULT_COLLATION=utf8_general_ci \
  -DWITH_MYISAM_STORAGE_ENGINE=1 \
  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  -DWITH_MEMORY_STORAGE_ENGINE=1 \
  -DWITH_READLINE=1 \
  -DENABLED_LOCAL_INFILE=1 \
  -DMYSQL_USER=mysql \
  -DMYSQL_TCP_PORT=3306 \
  -DWITH_BOOST=boost/boost_1_59_0
[root@backend-cxy ]#cd ./bin
[root@backend-cxy bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2017-09-05T15:03:41.067600Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-05T15:03:41.338120Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-09-05T15:03:41.369521Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-09-05T15:03:41.426215Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6778cd1c-924b-11e7-a8c2-0050569e3837.
2017-09-05T15:03:41.426860Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-09-05T15:03:41.429970Z 1 [Note] A temporary password is generated for root@localhost: rU?Dow;aA8oF

Install LVM on server 39.96.29.113

echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
/dev/mysql_data/mysqldata                /data           ext4    defaults              0 0

备份数据库

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ainidingDB         |
| ainidingGoodsDB    |
| ainidingOrderDB    |
| ainidingPersonDB   |
| ainidingStoreDB    |
| dscmall            |
| mysql              |
| performance_schema |
| svnadmin           |
| sys                |
| yunzhizaoCompanyDb |
+--------------------+
12 rows in set (0.00 sec)
mysql> use mysql;
mysql> select user, host from user;
+---------------+------------+
| user          | host       |
+---------------+------------+
| root          | %          |
| tangcong      | %          |
| root          | %localhost |
| mysql.session | localhost  |
| mysql.sys     | localhost  |
| root          | localhost  |
+---------------+------------+
6 rows in set (0.00 sec)
mysql> show grants for tangcong;
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for tangcong@%                                                                                                                                                                            |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, RELOAD, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON *.* TO 'tangcong'@'%'                    |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `ainidingStoreDB`.* TO 'tangcong'@'%'           |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingPersonDB`.* TO 'tangcong'@'%' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingOrderDB`.* TO 'tangcong'@'%'  |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingGoodsDB`.* TO 'tangcong'@'%'  |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingDB`.* TO 'tangcong'@'%'       |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
6 rows in set (0.01 sec)

新MySQL服务配置

create database ainiding_all;
create database dscmall;
create database svnadmin;
create database yunzhizaoCompanyDb;
create user 'tangcong' identified by 'user_password';
mysql -u root -p ainiding_all < ainidingDB.2019-01-12.sql
mysql -u root -p ainiding_all < ainidingGoodsDB.2019-01-12.sql
mysql -u root -p ainiding_all < ainidingOrderDB.2019-01-12.sql
mysql -u root -p ainiding_all < ainidingPersonDB.2019-01-12.sql
mysql -u root -p ainiding_all < ainidingStoreDB.2019-01-12.sql
mysql -u root -p dscmall < dscmall.2019-01-12.sql
mysql -u root -p svnadmin < svnadmin.2019-01-12.sql
mysql -u root -p yunzhizaoCompanyDb < yunzhizaoCompanyDb.2019-01-12.sql
GRANT SELECT, INSERT, UPDATE, DELETE, RELOAD, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON *.* TO 'tangcong'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `ainidingStoreDB`.* TO 'tangcong'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingPersonDB`.* TO 'tangcong'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingOrderDB`.* TO 'tangcong'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingGoodsDB`.* TO 'tangcong'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingDB`.* TO 'tangcong'@'%';
flush privileges;
[root@iz2ze5swka4isry986of3nz jvm]# nc -z -v 172.17.249.238 3306
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 172.17.249.238:3306.
Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.

install redis on server 39.96.29.113

[root@iz2zedgf358qnu5zp9jv4iz src]# ps -ef | grep redis
root     10133  6779  0 09:19 pts/1    00:00:00 ./redis-server *:6379
root     10138  6779  0 09:19 pts/1    00:00:00 grep --color=auto redis

install tomcat on server 39.96.20.193

查看老的应用服务器有哪几个tomcat在跑

[root@izwz90dk2jeypggsjii2xmz conf]# ll /usr/azpath/ | grep tomcat
drwxr-xr-x  4 root root       4096 May  2  2018 dubbo-admin-tomcat
drwxr-xr-x  9 root root       4096 Oct 10  2017 hudson-tomcat
drwxr-xr-x  9 root root       4096 Oct 10  2017 sonarqube-tomcat
drwxr-xr-x  9 root root       4096 Jul 21 15:30 svnadmin-tomcat
drwxr-xr-x 10 root root       4096 Dec 13 18:10 web-tomcat
Project Status
dubbo-admin-tomcat Running
husdon-tomcat Running
sonarqube-tomcat Sleep
svnadmin-tomcat Running
web-tomcat Running

新服务不用tomcat,排查为何页面卡

39.96.29.113服务器安装zookeeper

dataDir=/opt/zookeeper-3.4.13/data
dataLogDir=/opt/zookeeper-3.4.13/logs
[root@iz2ze5swka4isry986of3nz conf]# vim zoo.cfg 
[root@iz2ze5swka4isry986of3nz conf]# ../bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

[root@iz2ze5swka4isry986of3nz zookeeper-3.4.13]# netstat -anpt | grep 2181
tcp        0      0 0.0.0.0:2181            0.0.0.0:*               LISTEN      15734/java 

39.96.29.113服务器安装tomcat,启动dubbo-admin

[root@iz2ze5swka4isry986of3nz dubbo-admin]#  mvn package -Dmaven.test.skip=true 
-bash: mvn: command not found
[root@iz2ze5swka4isry986of3nz bin]# mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: /opt/apache-maven-3.6.0
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk1.8.0_191/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.2.2.el7.x86_64", arch: "amd64", family: "unix"
[ERROR] Failed to execute goal on project dubbo-admin: Could not resolve dependencies for project com.alibaba:dubbo-admin:war:2.5.4-SNAPSHOT: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT -> [Help 1]
[root@iz2ze5swka4isry986of3nz dubbo-admin]# vim pom.xml 
---------------修改前----------------------
<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>dubbo</artifactId>
   <version>${project.parent.version}</version>
  </dependency>
---------------修改后----------------------
<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>dubbo</artifactId>
   <version>2.5.3</version>
  </dependency>
[INFO] Building war: /opt/install_package/incubator-dubbo-dubbo-2.5.4/dubbo-admin/target/dubbo-admin-2.5.4-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:18 min
[INFO] Finished at: 2019-01-04T14:28:13+08:00
[INFO] ------------------------------------------------------------------------
[root@iz2ze5swka4isry986of3nz bin]# netstat -anpt | grep 80
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      27655/java          
tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN      27655/java          
tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN      27655/java 

install Rap

应用服务器上跑ainiding_manage程序

[root@iz2ze5swka4isry986of3nz ainiding_manage]# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8085            0.0.0.0:*               LISTEN      13218/java          
tcp        0      0 0.0.0.0:8086            0.0.0.0:*               LISTEN      13873/java 

各个服务对应的端口

Servier Nmae Port
ainiding-phone-api 8087
ainiding-phone-service 8088
ainiding-phone-wx 8089
ainiding-manage-service 8085
ainiding-manage-web 8086
ainiding-store-api 8081
ainiding-store-service 8084
[root@iz2ze5swka4isry986of3nz ainiding_phone]# ps -ef | grep ainiding
root      3904 13067  6 18:43 pts/0    00:01:03 java -jar ainiding-manage-web.war
root      3947 13273  4 18:44 pts/1    00:00:38 java -jar ainiding-manage-service.jar
root      4018 13067  3 18:45 pts/0    00:00:27 java -jar ainiding-store-api.jar
root      4143 13273  4 18:45 pts/1    00:00:37 java -jar ainiding-store-service.jar
root      4497 13273 50 18:58 pts/1    00:00:29 java -jar ainiding-phone-api.jar
root      4541 13067 88 18:58 pts/0    00:00:33 java -jar ainiding-phone-service.jar
root      4594 13273 99 18:59 pts/1    00:00:33 java -jar ainiding-phone-wx.war

[root@iz2ze5swka4isry986of3nz ainiding_phone]# ps -ef | grep ainiding
root      3904 13067  6 18:43 pts/0    00:01:03 java -jar ainiding-manage-web.war
root      3947 13273  4 18:44 pts/1    00:00:38 java -jar ainiding-manage-service.jar
root      4018 13067  3 18:45 pts/0    00:00:27 java -jar ainiding-store-api.jar
root      4143 13273  4 18:45 pts/1    00:00:37 java -jar ainiding-store-service.jar
root      4497 13273 50 18:58 pts/1    00:00:29 java -jar ainiding-phone-api.jar
root      4541 13067 88 18:58 pts/0    00:00:33 java -jar ainiding-phone-service.jar
root      4594 13273 99 18:59 pts/1    00:00:33 java -jar ainiding-phone-wx.war

应用服务器安装nginx

yum install -y gcc gcc-c++
yum install -y bzip2 bzip2-devel
yum install -y zlib zlib-devel
yum install -y readline readline-devel
./configure --prefix=/usr                     \
            --docdir=/usr/share/doc/pcre-8.42 \
            --enable-unicode-properties       \
            --enable-pcre16                   \
            --enable-pcre32                   \
            --enable-pcregrep-libz            \
            --enable-pcregrep-libbz2          \
            --enable-pcretest-libreadline     \
            --disable-static                 &&
make

make install                     &&
mv -v /usr/lib/libpcre.so.* /lib &&
ln -sfv ../../lib/$(readlink /usr/lib/libpcre.so) /usr/lib/libpcre.so
./configure  --prefix=/usr/local/nginx  --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/nginx/access.log  --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock  --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi

make && make install 
        server_name  store.ainiding.com;
        location / {
           proxy_pass http://127.0.0.1:8086;
           proxy_set_header Host $host;
           proxy_set_header X-Forwarded-For $remote_addr;
        }
        listen       443;
        listen       80;
        server_name  store.ainiding.com;
        ssl                  on;
        ssl_certificate      /root/andcrt/1560528__ainiding.com.crt;
        ssl_certificate_key  /root/andcrt/1560528__ainiding.com.key;
        error_page 497  https://$host$uri?$args;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

更新域名解析

上一篇下一篇

猜你喜欢

热点阅读