[LINUX] About database, nginx, zookeeper, kafka, Jar package, tomcat startup method

Uncle Cthulhu 2022-11-24 21:25:00 阅读数:831

linuxdatabasenginxzookeeperkafka

1. Database

Database startup Method 1: /etc/init.d/mysqld startMethod 2: Service mysql start(If you report insufficient permissions, it is because you are not the owner of the mysql account)Change the owner of mysqlIt turns out that the owner and group of /var/run/mysqld/ are still root, and mysql cannot create files in it. After modifying the owner and group of this directory, start OK.[[email protected] ~]# ls -ld /var/run/mysqld/drwxr-xr-x 2 root root 40 Jan 20 18:28 /var/run/mysqld/[[email protected] ~]# chown mysql.mysql /var/run/mysqld/[[email protected] ~]# /etc/init.d/mysqld startStarting mysqld (via systemctl): [ OK ]

2. Start zookeeper first and then kafka. The order cannot be wrong

Go to the zk directory firstcd /opt/zkdata/zookeeper-3.4.6Restart the ZK service: sh bin/zkServer.sh restartStart ZK service: sh bin/zkServer.sh startView ZK service status: sh bin/zkServer.sh statusStop ZK service: sh bin/zkServer.sh stop

3. Start kafka

Go to the kafka directory firstcd /opt/zkdata/kafka_2.11-0.11.0.1nohup>Kafka bin/kafka-server-start.sh config/server.properties 2>&1 &

Start by starting the Jar package in the background

4. Start Nginx

Start nginx nginx -c /etc/nginx/nginx.confstop nginxnginx -s stoprestart nginxnginx -s reloadnginx #Start nginxnginx -s quit #stop nginx quicklynginx -V #View version, and configuration file addressnginx -v #View versionnginx -s reload|reopen|stop|quit #Reload configuration|restart|quick stop|close nginx safelynginx -h # help ååExactly the environment nginx configuration file /home/nginx/nginx/conf/conf.dThe configuration file is generally in ./etc/nginx/conf.d/reverse-proxy.confRestart the missing pid file:::: Solve the problem, kill all nginx processes first, and execute nginx -c /etc/nginx/nginx.confnginx -c /etc/nginx/nginx.conf

5. Start the Jar package

nohup>Gps java -jar gps.jar 2>&1 &

nohup: output files to Gps, 2>&1 &: No operation is required after startup, the background runs forever

(2>&1 is used to redirect standard error 2 to standard output 1. The & in front of 1 here is to let Jar interpret 1 as standard output instead of file 1. As for the last &, thenIt is to let Jar execute in the background.)

6. Start the tomcat war package

cd apache-8080/bin./startup.sh

7. Other commands

Check the file location according to the process pid:A: Determine the process number.ps aux|grep nginx such as: 4874B: Find the files executed by the process.ps aux | grep 4874C: Determines the directory where the process resides.ll /proc/4874

Note: I am not a professional operator, but all the above commands are used by myself, and they can all run normally. If there is any error, please point out.

copyright:author[Uncle Cthulhu],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/328/202211242120378081.html