cgb2008-jingtao day09

1.Linux view command

1.1 File View

cat output file all the contents
of all of the content more output document, page output, the space next screen browse, q quit
less usage and more the same, but is controlled by PgUp, PgOn key
tail used to display the file after a few numbers, frequent use
tail -10 nginx.conf View the last 10 lines of
nginx.conf tail –f nginx.conf View the log dynamically, which is convenient for viewing the new information in the log
ctrl+c End view

1.2 Script commands

Requirements: It is required to start 10 tomcat servers at one time.
Edit script: vim start.sh
Insert picture description here
Start script:sh start.sh
Insert picture description here

2.Linux install nginx

Blog address: https://blog.csdn.net/qq_16804847/article/details/109580325

2.1 Delete Nginx configuration file

2.1.1 Delete source file directory

Insert picture description here

2.1.2 Delete working directory

Insert picture description here

3. Modify the Linux system IP address

Note: The new Linux IP address needs to be changed from the original 192.168.126.129 to 192.168.126.130 for
details:
https://blog.csdn.net/qq_16804847/article/details/108471266

4. System Restore

4.1 Modify the image.properties file

Insert picture description here

4.2 Modify port number

Insert picture description here

4.3 Modify HSOTS file

Insert picture description here

4.4 Modify Windows nginx configuration

Description: Point Nginx routing address to this machine
Insert picture description here

4.5 Turn off extra Linux services

Insert picture description here

5. Linux modify IP address

5.1 Path address

Insert picture description here

5.2 Modify IP

vim ifcfg-ens33
Insert picture description here
restart the network card command: service network restart

6. Database optimization

6.1 Database synchronization

6.1.1 Cold database backup

Manually dump the database files on a regular basis .
Disadvantages:
1. Low efficiency
2. Data may be lost
Reason: Cold database backup is the last effective method for the company to restore data.

6.1.2 Database hot backup

Backup principle:
1. When the database is modified, the modified information will be written to the binary log file (the binary file is closed by default).
2. When there is data in the binary log file, the database will be read from the library through the IO thread
Get the binary file information. 3. The IO thread writes the read data to the relay log.
4. The Sql thread writes the files in the relay log to the slave database, and finally realizes the master-slave synchronization of the database.
Insert picture description here

6.2 Modify the main database configuration of the database

6.2.1 Construction strategy

129 as the main library, 130 as the slave library

6.2.2 Modify the binary log file

1). Edit the location of the binary file
Insert picture description here
2). Modify the content of the binary file
Insert picture description here

3). Restart the database and check whether the binary log file is valid
Insert picture description here

6.3 Modify the database configuration from the database

Insert picture description here
Restart the database and check the binary log
Insert picture description here

6.4 Achieve master-slave synchronization of the database

6.4.1 Determine the status of the main library

Insert picture description here

6.4.2 Configure master-slave mount

/*我是130  从库  IP/PORT/USER/PASSWROD/二进制日志/pos*/
CHANGE MASTER TO MASTER_HOST="192.168.126.129",
MASTER_PORT=3306,
MASTER_USER="root",
MASTER_PASSWORD="root",
MASTER_LOG_FILE="mysql-bin.000001",
MASTER_LOG_POS=245;

/*开启主从服务*/
START SLAVE;	

/*检查主从服务状态*/
SHOW SLAVE STATUS;

/*如果启动不成功 执行如下步骤  检查最后几项的报错信息 
  之后修改配置文件. 关闭主从服务.之后重新执行挂载命令
*/
STOP SLAVE;

6.4.3 Database master-slave test

Add a database table to the main library and check whether the slave library is synchronized.
Insert picture description here

6.4.4 Resource file download

Go to Code Cloud to download the specified file.
Insert picture description here

operation

Preview database master-slave replication/read-write separation/database high availability.

Guess you like

Origin blog.csdn.net/qq_16804847/article/details/110622450