1. About server retrieval instructions
1.1 retrieval java Program
command : jps
Close the process :
- kill PID Number “ The humble killing process ” If the current process item is used by another process , It doesn't shut down .
- kill -15 PID Number “ Gently kill ” You can do the aftermath before you're killed
- kill -9 PID Number Force to kill
1.2 Retrieve any program
command : ps -ef | grep xxxx The service name
explain : ps -ef Means to get the current Linux All the service information in the system . “|” Pass the result of the query before the pipeline as a parameter to the following operation .
Example :
1.3 About the firewall
1). Check the open ports of the firewall
`firewall-cmd --list-ports`
2). Check that the port is open
`firewall-cmd --query-port 80/tcp`
* 1
3). Turn on the firewall
`firewall-cmd --zone=public --add-port=80/tcp --permanent`
4). Remove port
`firewall-cmd --zone=public --remove-port=9090/tcp --permanent`
* 1
5). An explanation of firewall operation
–zone # Scope
–add-port=80/tcp # Add port , The format is : port / Communication protocol
–remove-port=80/tcp # Remove port , The format is : port / Communication protocol
–permanent # permanent , Failure after restart without this parameter
6). service iptables restart
`firewall-cmd --reload`
2.Linux install Nginx The server
2.1 Linux Project deployment diagram
2.2 Nginx install
2.2.1 Linux download nginx The server
2.2.2 Upload Nginx The server
2.2.3 decompression nginx
command : [[email protected] src]# tar -zxvf nginx-1.19.3.tar.gz
2.2.4 nginx Directory structure problem
nginx There is 2 Directory structure :
1. Source directory be responsible for nginx Installation edit Wait for the operation .
Installation command :
- [[email protected] nginx]# ./configure
- make
- make install
`2. working directory be responsible for nginx Reverse proxy and other configuration ....
/usr/local/nginx`
2.2.5 nginx command
explain :nginx The directory should be in “/usr/local/nginx”
command :
Get into sbin After the catalog , Carry out relevant operations
command :
`./nginx start-up nginx
./nginx -s reload restart nginx
./nignx -s stop stop it nginx`
Start the effect test :
2.3 Linux nginx Implement reverse proxy / Load balancing
2.3.1 Implement domain name proxy
demand : Require users to pass http://manage.jt.com The way to visit ...
2.3.2 To configure nginx The server
explain : modify In the working directory nginx after Keep the profile . After the restart nginx that will do
`#1. To configure Linux colony
server {
listen 80;
server_name manage.jt.com;
location / {
proxy_pass http://tomcats;
}
}
upstream tomcats {
server 192.168.126.129:8081;
server 192.168.126.129:8082;
}
# To configure Linux Picture agent
server {
listen 80;
server_name image.jt.com;
location / {
# Configure the image disk address .
root /usr/local/src/images;
}
}`
3.Linux Mysql Cluster building
3.1 preview IP Address modification
3.1.1 Modify virtual machine MAC Address
When you create a new virtual machine , modify mac network address .
3.1.2 Check IP Address
command : ip addr
without IP The display performs the following commands
`service NetworkManager stop
chkconfig NetworkManager off Permanent ban Manager network card
service network restart restart network network card `
3.1.3 modify IP Address
1). find IP Directory of addresses
`cd /etc/sysconfig/network-scripts/`
2). modify IP Address .
`vim ifcfg-ens33`
After the modification is completed Save to exit .
3). Restart NIC Check IP Is the address correct
3.2 Why we need to build Mysql colony
describe : If a single database is used in the project , If the equipment is damaged due to irresistible factors , Data loss , Will directly affect the use of users . It needs to be optimized .
3.3 Database backup mode
3.3.1 Database cold backup
explain : regular Pass the files in the database through sql The way to dump . Ensure that the data is backed up within a certain period of time .
shortcoming : Because it's a regular backup , So it may lead to the loss of data .
Cold backup of database Is the last effective way to recover data . So it continues to use .
3.3.2 Database hot backup
explain : Because the database synchronization operation is very frequent in the work , So as a database developer , Also designed how to synchronize the database .
The steps of synchronization :
- If the master database needs to start the synchronization strategy , The binary log file must be opened .( It's off by default .)
- When the user " to update " Database time , The main database will write the update information to the binary log file . ( The main database task ends )
- From the library will use IO The thread reads the updated binary log file in the main library .
- IO The thread will read the information using asynchronous First save to the relay log .( Relay a medium for temporary storage of data )
- SQL The thread will read the information in the relay log , After the sql Statements are synchronized to the slave database . At this point, the master-slave synchronization is realized …
4 Realize the construction of master-slave database
4.1 Open the main library binary file
command : vim /etc/my.cnf
4.2 Restart the database
explain : After modifying the configuration file , Need to restart the database , Make the binaries work .
4.3 Configure from database
explain : According to the configuration information of the master database Configure from database As shown in the figure Once the configuration is complete , Restart the database
4.4 Realize the mount of master-slave
Main library : 192.168.126.129 master
Slave Library : 192.168.126.130 slave
4.4.1 Check the master database status information
4.4.2 Realize the master-slave mount
4.4.3 Instructions for resetting binary log files
Problem description : Sometimes after restarting the host many times , Will generate multiple binary file information . As shown in the figure
Solution : Delete extra binary log files , Then restart the database
Then mount it again
Homework
1. Realization Linux Project deployment
129: 8081/8082/8083
130: 8081/8082/8083
requirement : be-all tomcat All servers should be linked to the master database matters needing attention Link to the main library IP Address .
- Deploy 2 From the database 129 host 130/131 from The structure of one master and two slaves .
- Yes bug About pictures Temporary neglect Why does this happen …