Cool breeze AAA 2022-02-13 07:43:42 阅读数:459
1. Deployment of Jingtao project ( No installation nginx)
2. Server retrieval instructions
linux Kill process
Firewall specific port description
3.linux Add to the project nginx Deploy
4. Jingtao database optimization
Database backup
linux Not installed yet nginx, Only through ip+ Port number access .
1). explain : because windows The path and Linux The paths are not the same , So you have to prepare a Linux The root directory of the image upload to save the image .
2). Prepare directory :
3). modify image.properties file
explain : It's on it Windows Configuration path (D:/JT-SOFT/images
), Here is Linux Configuration path (/usr/local/src/images
).
explain :
hold jt Project printing 2 Put a package in an empty directory , After the linux Prepare a directory in your working directory , Drag to upload .
command :
java -jar 8081.war
: This startup mode will occupy the current end segment and can't do other operations , You can only exit to operate , Because the project is published in linux On the system , So closing the terminal window is equivalent to closing tomact The server .
java -jar 8081.war &
: & Indicates that other operations will be performed next , enter
Will automatically jump out .
perform :java -jar 8081.war &
enter Key out , perform :java -jar 8082.war &
1. because linux No installation nginx, So it's only through ip+ Port number
visit .
2. Also because there is no linux, So the picture can't echo .
visit :8081
In the same way :8082
command :jps
effect : Check all java service . The number is the process number (pid)
Close the process :
1.kill PID Number :“ The humble killing process ” If the current process item is used by other processes , It doesn't shut down .
2.kill -15 PID Number : “ Gently kill ” You can do the aftermath before you're killed
3.kill -9 PID Number : Force to kill
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. retrieval mysql Process number
2. Retrieve all to java The process number at the beginning of the command .
It's best not to simply eliminate violence to the top and directly close the firewall at work , May be hacked . Usually open a specific port number on the firewall .
1). Check the list of ports open by the firewall ( The premise is to turn on the firewall first )
firewall-cmd --list-ports
2). Check that the port is open
firewall-cmd --query-port 80/tcp
3). Turn on the firewall xxxx
# New port
firewall-cmd --zone=public --add-port=80/tcp --permanent
4). Remove port
firewall-cmd --zone=public --remove-port=9090/tcp --permanent
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
Now it's time to deploy the project to linux Server ,nginx It belongs to the server agent, so nginx Actually deployed to linux On the system .
Download... On the official website linux Version of nginx, Then upload to the working directory :/usr/local/src/
1. command : tar -zxvf xxxxxx
( Because the compressed package is downloaded here )
2. Move the installation package to the directory dedicated to the compressed package software, And decompress nginx Change of name
nginx There is 2 Directory structure :
1. Source directory : be responsible for nginx Installation Compilation and other operations .
Installation command :
Execute this in turn 3 An order .
1. ./configure
2. make
3. make install
1.1 Execute the script file in the current directory :./ xxx
( Green files represent script files )
1.2 compile
1.3 install
2. working directory :/usr/local/nginx
( be responsible for nginx Reverse proxy and other configuration …)
1). explain :nginx The start-up of should be in “/usr/local/nginx”
(nginx Working directory of )
explain :
conf: Profile directory
html: Default page directory
logs: Log directory
sbin:nginx Start Directory
2). Get into sbin After the catalog , start-up nginx.
linux Version of nginx command :
./nginx start-up nginx
./nginx -s reload restart nginx
./nignx -s stop stop it nginx
3). Start the effect test :`http://192.168.126.129:80``
demand : Require users to pass http://manage.jt.com Mode of access Linux Medium nginx, And load balancing .
1). It needs to be modified first hosts file .
2). close windows Medium nginx Prevent interference .
3). modify .conf file
#1. To configure tomact colony
server {
listen 80;
server_name manage.jt.com;
location / {
proxy_pass http://jt;
}
}
upstream jt {
server 192.168.126.129:8081;
server 192.168.126.129:8082;
}
#2. To configure linux Picture agent
server {
listen 80;
server_name image.jt.com;
location / {
# Configure the image disk address .
root /usr/local/src/images;
}
}
4).ctrl+s preservation :
5). start-up nginx
6). Access test
Change the name of the virtual machine , And re unzip a copy linux System to virtual machine .
explain : Because now you are decompressing the same linux System , So now the host ip identical , You need to modify the of the second virtual machine ip.
modify MAC Address , Then click OK , Re running the virtual machine .
explain : Because now the host ip identical , So now you can't connect through remote tools , Now it can only be changed through a black window .
1). Check IP Address
command : ip addr
without IP Then execute the following command to restart the network card .
service NetworkManager stop
chkconfig NetworkManager off Permanent ban Manager network card
service network restart restart network network card
2). modify IP Address
2.1). find IP Directory of addresses
cd /etc/sysconfig/network-scripts/
2.2). compile ifcfg-ens33 file .
vim ifcfg-ens33
Click on i—> hold 129 Change it to 130---->Esc—>:wq sign out .
3). Restart NIC Check IP Is the address correct
4). Connect via remote tools
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 .
solve : Database backup .
explain : Periodically 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 :
1. The database cold backup is operated manually , Very inconvenient
2. Database cold backup is performed regularly , therefore May cause data loss .
But companies still use this method , Because it's better to lose some than all , Database cold backup is the last effective means to restore data .
Be careful :
1. Start the database first to connect successfully .
2. What's starting up here is linux The database inside .( Start command :systemctl start mariadb)
step :
1. Select the database to export .
2. Select the directory to export
Hot backup : Continuously synchronize the data of the master database to the slave database .
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 :
1). Test network connection
2) A little : Step view day09–>5.3.
explain : Because it is necessary to realize the master-slave synchronization of the database , therefore Before configuring master-slave The information in the database must be consistent .
step :
1. take Main library The information of is exported by cold backup .
2. In the database Slave Library Import jtdb.sql File can .
copyright:author[Cool breeze AAA],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130743383750.html