Centos7.x System Installation CONSUL1.4.2

This article introduces the use of docker to install consul and traditional deployment:
1. Docker-based installation and deployment of consul:
1. Run consul directly with docker run and download the consul1.4.2 image

< hr>

#docker run -d –name consul consul:1.4.2


2. Copy the /consul directory in the consul image to the local storage, and the data information will persist

p>


#export CONSULE_CONTANER_ID=docker ps -aq
#docker cp ${containerId}:/consul /software/consul
#docker rm -f consul< /p>


3, start consul service


docker run -d –name=consul -v /software/consul:/consul –net=host consul:1.4 .2 agent –bind=192.168.8.129 –server=true –node=consul –bootstrap-expect=1 –client=0.0.0.0 -ui


4. Configure account opening 8500 firewall port, the browser can access
#firewall-cmd –zone=public –add-port=8500/tcp –permanent
#firewall-cmd –reload
http:192.168 .8.129:8500
CentOS7.X system installation and deployment Consul1.4.2
Two, traditional way Installation and deployment
1. Install dependencies, download the installation package


#yum -y install wget unzip zip
#wget -c https://releases.hashicorp.com/consul/ 1.4.2/consul_1.4.2_linux_amd64.zip
#unzip consu l_1.4.2_linux_amd64.zip -d /usr/bin


2, create a configuration file directory


#mkaid /software/consul/logs
# mkdir /etc/consul.d/
#vi /etc/consul.d/basic.json
{
“ports”: {
“http”: 8500 ,
“dns” : 8600,
“grpc”: 8400,
“serf_lan”: 8301,
“serf_wan”: 8302,
“server”: 8300
}
}


Note: The default port used by consul is 8500 8600 8400 8301 8302 8300
3. Configure consul system service


#vi /etc/init.d/consul
#!/bin/bash
#chkconfig: 2345 89 10
#description: consul Start Stop Restart
#processname: consul
EXCMD=consul
StartDir=/usr/bin /${EXCMD}
pid=ps -ef|grep -v grep| grep consul |awk'{print $2}'
case $1 in
start)
nohup ${StartDir} agent -server -ui -advertise=192.168.8.129 -bind=192.168.8.129 -client=0.0.0.0 -data-dir /software/consul/data -bootstrap-expect 1 -log-file /software/ consul/logs/ -config-dir /etc/consul.d> /dev/null 2>&1 &
;;
stop)
kill -9 $pid
;;
restart )
kill -9 $pid
nohup ${StartDir} agent -server -ui -adve rtise=192.168.8.129 -bind=192.168.8.129 -client=0.0.0.0 -data-dir /software/consul/data -bootstrap-expect 1 -log-file /software/consul/logs/ -config-dir /etc/ consul.d> /dev/null 2>&1 &
;;
esac
exit 0


4. Add self-start to consul system service authorization


#chmod +x /etc/init.d/consul
#chkconfig –add consul
#chkconfig –level 2345 consul on
#chkconfig –list consul


5. Firewall port opening
#firewall-cmd –permanent –zone=public –add-port=8500/tcp
#firewall-cmd –reload
# firewall-cmd –zone=public –add-port=8500/tcp –permanent
#firewall-cmd –reload
http:192.168.8.129:8500
6. Explanation of Consul startup parameters:
The following parameters can be added to the startup of Consul. Some parameters are in conflict and cannot be used at the same time.


-advertise: The notification display address is used to change the address we display to other nodes in the cluster In general, -bind address is the display address -bootstrap: used to control whether a server is in bootstrap mode. Only one server in a datacenter can be in bootstrap mode. When a server is in bootstrap mode, it can be elected as the raft leader by itself . -bootstrap-expect: The number of server nodes expected to be provided in a datacenter. When this value is provided, consul will not boot the entire cluster until the specified number of sever is reached. This tag cannot be shared with bootstrap -bind: this address is used For communication within the cluster, all nodes in the cluster must be reachable to addresses. The default is 0.0.0.0-dc: this tag controls the name of the datacenter allowed by the agent, and the default is dc1-encrypt: specify the secret key to enable Consul encrypts during communication. The key can be generated by consul keygen. The nodes in the same cluster must use the same key-join: add the ip address of an already started agent, and you can specify multiple agent addresses multiple times. If consul cannot join any specified address, the agent will fail to start. By default, no node will be added when the agent starts. -retry-join: Similar to join, but allows you to try after the first failure. -retry-interval: the time interval between two joins, the default is 30s-retry-max: the number of repeated join attempts, the default is 0, which means unlimited attempts -log-level: log information displayed after the consul agent is started level. The default is info, optional: trace, debug, info, warn, err. -protocol: The protocol version used by consul -rejoin: Make consul ignore the previous departure and still try to join the cluster after restarting. -syslog: turn on the system log function, only valid on linux/osx -pid-file: provide a path to store the pid file, which can be used for SIGINT/SIGHUP (close/update) agent

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4875 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.