Deployment of java projects

Keywords: Nginx MySQL MongoDB Tomcat

Open source component deployment

  1. jdk1.8.0_141 and above
  2. tomcat 7.0.45 and above below 9
  3. nginx 1.12.1
  4. mongoDb 3.4.6
  5. mysql 5.6.37
  6. elasticsearch 5.4.2

I. Installation of Software

jdk1.8.0_141

1.jdk compression package put in / work to decompress tar-zxvf jdk-8u141-linux-x64.tar.gz

2. Setting environment variables

Vim/etc/profile is added at the bottom

JAVA_HOME=/work/jdk1.8.0_141
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/toos.jar
export PATH JAVA_HOME CLASSPATH

3. Execute the command source/etc/profile to make the settings work

4. java-version to see if the installation was successful

tomcat 7.0.85

1.tomcat compression package is put under / work to decompress tar-zxvf apache-tomcat-7.0.85.tar.gz

2. Start Tomcat execution. /work/tomcat/bin/startup.sh

3. Visit 127.0.0.1:8080 to see if the installation was successful

4. Close tomcat/work/tomcat/bin/shutdown.sh

nginx 1.12.2

1. Unzip and install nginx package under / work

vi /etc/resolv.conf

nameserver 223.5.5.5

cd /etc/yum.repos.d

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install nginx

systemctl stop firewalld.service

2. Start nginx. system CTL start nginx. service

3. Access 127.0.0.1 is successfully installed

4. Modify the configuration file/etc/nginx/conf.d/default.conf as follows

The directory stored here is:

/work/nginx/console/index.html

/work/nginx/hut/index.html

upstream ha{
        server 127.0.0.1:8080;
}

server {
   
     listen       80;
     
     server_name  localhost;
     root /work/nginx;

     location ^~ /plantdata_console {
        proxy_pass http://ha;
     }
     location ^~ /hut_ws {
        proxy_pass http://ha;
     }
     location /hut {
        index  index.html;
     }
     location /console {
        index  index.html;
     }
     location /cms {
        index  index.html;
     }
}

5. Restart nginx. system CTL restart nginx. service

6. Note that you need to close selinux

setenforce 0

You can check with the getenforce command

mongoDb 3.4.6

1. Put the mongoDb compressed package under / work to decompress tar-zxvf mongodb-linux-x86_64-rhel70-3.4.6.tar.gz

2. New configuration file mongodb.cnf

#Where to store the data.
dbpath=/work/mongodb-linux-x86_64-rhel70-3.4.6/data
#where to log
logpath=/work/mongodb-linux-x86_64-rhel70-3.4.6/mongodb.log
logappend=true
bind_ip=127.0.0.1
port=19130

3. New Documents

mkdir /work/mongodb-linux-x86_64-rhel70-3.4.6/data
touch /work/mongodb-linux-x86_64-rhel70-3.4.6/mongodb.log

4. Start. / mongod-f.. / mongodb. CNF & and note that mongod is under bin in the mongo directory

mysql 5.6

1. Download and install MySQL package version 5.6 file

wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

2.yum installation

yum -y install mysql-community-release-el6-5.noarch.rpm
yum -y install mysql-community-server

3.MySQL database settings

Start MySQL `system CTL start mysqld. service first`
    
View the MySQL running status, as shown in the figure: system CTL status mysqld.service

At this time, MySQL has started to run normally, but to enter MySQL, you have to find the password of the root user at this time. You can find the password in the log file by following commands: `grep'password / var / log / mysqld. log`

The following commands enter the database: mysql-u root-p
    
Enter the initial password, and nothing can be done at this time, because MySQL must change the password by default before it can operate the database:
     
set password for root@localhost=password('root');

FLUSH PRIVILEGES;

4. Perform data schema initialization

data base mydb

create database mydb
use mydb

source /work/install/sql/db.sql

elasticsearch 5.4.2

1. Put the elastic search compression package under / work to decompress tar-zxvf elastic search-5.4.2. tar.gz

2. Unzip the elastic search-analysis-ik-5.4.2.zip to the plugins/ik in the installation directory

3. If the above command is logged in and executed by root user, you will see an error prompt requiring a new user command as follows

useradd elasearch

Modify file for all users chown-R elasearch/work/elastic search-5.4.2/

4. boot

su elasearch
./bin/elasticsearch &

5. The Library of elastic search

Notice in particular that the elastic search configuration:

/work/elasticsearch-5.4.2/config/elasticsearch.yml

Add to
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.system_call_filter: false

es The default cluster name is cluster.name: my-application
 Clusters are automatically searched in the case of Intranet connectivity
 When testing es is started, be sure to specify a name that does not match the default cluster.name

6. Attention

switchrootuser
error1: 
max number of threads [1024] for user [elasearch] is too low, increase to at least [2048] 
Add or modify /etc/security/limits.d/90-nproc.conf The following sentence
*          soft    nproc     4096

     
error2: 
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 
implement  sysctl -w vm.max_map_count=262144 

error3: max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536] 
implement  ulimit -n 65536 

error4 : system call bootstrap.system_call_filter: false
Add to vim /etc/security/limits.conf
     soft memlock unlimited
     hard memlock unlimited

error5 :max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
implement   cp /etc/security/limits.conf /etc/security/limits.conf.bak
               cat /etc/security/limits.conf | grep -v "elasearch" > /tmp/system_limits.conf
               echo "elasearch hard nofile 65536" >> /tmp/system_limits.conf 
               echo "elasearch soft nofile 65536" >> /tmp/system_limits.conf 
               mv /tmp/system_limits.conf /etc/security/limits.conf

Posted by coolcat on Fri, 10 May 2019 03:48:38 -0700