Linux deploys the springboot project in two ways.
Deploy jar package (officially recommended)
When running a Jar file on a linux server, the usual methods are:
$java-jartest.jar
The characteristic of this method is that when the ssh window is closed, the program stops running, or it cannot be cut out to perform other tasks at runtime. Is there any way to make Jar run in the background?
Method 1:
$nohupjava-jartest.jar
//nohup means that the run command is not suspended. When the account exits or the terminal is closed, the program still runs.
//When executing a job with the nohup command, by default, all the output of the job is redirected to the nohup.out file.
//Unless an output file is specified otherwise.
Method 2:
$ nohup Java-jartest . jar & gt; Temporary text
//This method will input the log file into the file you specify, otherwise it will be created automatically.
Job command and fg command:
$ TERM Jobs
//Then all jobs executed in the background will be listed, with a number in front of each job.
//If you want to turn a job back to the foreground control, you only need the fg+ sign.
$fg2
View the pid of the thread occupied by the port.
netstat-nlp|grep:8080
How to build a server cluster? Linux platform?
The construction of linux server cluster platform is relatively simple, and there are special balancing software, such as lvs, which is a cluster system composed of many servers. It can be divided into three layers according to needs. The first layer is the front-end machine, which is used for balance, which is equivalent to the fair distribution of work for the system. The second layer is server groups, such as web server groups, DNS, mail groups, etc. These are receptionists. They handle the work assigned by the equalizer. The third floor is storage. Knowing this, it is very easy to build, and there are ready-made software. For example, I have four web servers, two databases, 1 front-end, linux system and lvs software. For example, heartbeat-2.1.4-9.el5.i386.rpm heartbeat-l director-2.1.4-9.el5.i386.rpm libnet-1. .4-3.el5.i386.-9.el5.i386.rpm heartbeat-piles-2.1.4-10.el5 You can provide detailed installation instructions about lvs cluster yourself. I hope I can help you.
Teach you how to build a linux server step by step.
Deployment, configuration and construction steps of Linux server:
1. Ready:
1. 1 . JDK 1.8:JDK-8u 1 1-Linux-x64 . tar . gz .
Tomcat:Apache-Tomcat-8 . 0 . 39-windows-x64 . zip .
1.2. Install a 1.8 jdk first, and pay attention to linuxforjdk, otherwise it won't work.
Then create a new java folder under /usr/ in the root directory (the root directory here should be accessed by cd first and then /usr/ instead of home/xxx, and you can view the current path through pwd)/usr/ to place the extracted jdk file). Here, because the suffix is tar.gz, you can directly decompress it with tar-xf command.
2. Configuration:
2. 1. Configure the environment variables of JDK: Go to the /etc/ folder to find the configuration file, and add variable parameters at the end of the file through the file editing command viprofile:
JAVA _ HOME =/usr/JAVA/JDK 1 . 8 . 0 _ 1 1
PATH=$JAVA_HOME/bin:$PATH
Classpath =. :$ JAVA _ HOME/JRE/lib/rt . jar:$ JAVA _ HOME/lib/dt . jar:$ JAVA _ HOME/lib/tools . jar
2.2. Unzip the downloaded tomcat to a custom folder, mine is home/pengyy/tomcat/, change the port number in the configuration file, and edit server.xml with vi command. Later, when I started, the port of 8005 was in conflict, so I changed it directly to 8088. Then put /html as the default webpage file name: index.html6, the browser tests ifconfigens33, checks the address of ens33 network card, enters your IP in the browser, and you can see what you want to help in the test file!