installing consul

[root@instance-1 ~]# wget https://releases.hashicorp.com/consul/1.0.0/consul_1.0.0_linux_amd64.zip

[root@instance-1 ~]# ls -l
-rw-r–r–. 1 root root 10407455 Oct 16 16:36 consul_1.0.0_linux_amd64.zip

[root@instance-1 ~]# yum install unzip -y

[root@instance-1 ~]# unzip consul_1.0.0_linux_amd64.zip
Archive: consul_1.0.0_linux_amd64.zip
inflating: consul

[root@instance-1 ~]# ls -l
-rwxr-xr-x. 1 root root 42845786 Oct 16 16:30 consul
-rw-r–r–. 1 root root 10407455 Oct 16 16:36 consul_1.0.0_linux_amd64.zip

[root@instance-1 ~]# cp consul /bin/

[root@instance-1 ~]# consul
Usage: consul [–version] [–help] <command> [<args>]

Available commands are:
agent Runs a Consul agent
catalog Interact with the catalog
event Fire a new event
exec Executes a command on Consul nodes
force-leave Forces a member of the cluster to enter the “left” state
info Provides debugging information for operators.
join Tell Consul agent to join cluster
keygen Generates a new encryption key
keyring Manages gossip layer encryption keys
kv Interact with the key-value store
leave Gracefully leaves the Consul cluster and shuts down
lock Execute a command holding a lock
maint Controls node or service maintenance mode
members Lists the members of a Consul cluster
monitor Stream logs from a Consul agent
operator Provides cluster-level tools for Consul operators
reload Triggers the agent to reload configuration files
rtt Estimates network round trip time between nodes
snapshot Saves, restores and inspects snapshots of Consul server state
validate Validate config files/directories
version Prints the Consul version
watch Watch for changes in Consul

[root@instance-1 ~]# consul version
Consul v1.0.0
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)

[root@instance-1 ~]# consul agent -dev
==> Starting Consul agent…
==> Consul agent running!
Version: ‘v1.0.0’
Node ID: ‘b790b43d-ab83-26f6-4d43-b4b95511db28’
Node name: ‘instance-1’
Datacenter: ‘dc1’ (Segment: ‘<all>’)
Server: true (Bootstrap: false)
Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, DNS: 8600)
Cluster Addr: 127.0.0.1 (LAN: 8301, WAN: 8302)
Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false

==> Log data will now stream in as it occurs:

2017/11/12 12:58:24 [DEBUG] Using random ID “b790b43d-ab83-26f6-4d43-b4b95511db28” as node ID
2017/11/12 12:58:24 [INFO] raft: Initial configuration (index=1): [{Suffrage:Voter ID:b790b43d-ab83-26f6-4d43-b4b95511db28 Address:127.0.0.1:8300}]
2017/11/12 12:58:24 [INFO] raft: Node at 127.0.0.1:8300 [Follower] entering Follower state (Leader: “”)
2017/11/12 12:58:24 [INFO] serf: EventMemberJoin: instance-1.dc1 127.0.0.1
2017/11/12 12:58:24 [INFO] serf: EventMemberJoin: instance-1 127.0.0.1
2017/11/12 12:58:24 [INFO] agent: Started DNS server 127.0.0.1:8600 (udp)
2017/11/12 12:58:24 [INFO] consul: Adding LAN server instance-1 (Addr: tcp/127.0.0.1:8300) (DC: dc1)
2017/11/12 12:58:24 [INFO] consul: Handled member-join event for server “instance-1.dc1” in area “wan”
2017/11/12 12:58:24 [INFO] agent: Started DNS server 127.0.0.1:8600 (tcp)
2017/11/12 12:58:24 [INFO] agent: Started HTTP server on 127.0.0.1:8500 (tcp)
2017/11/12 12:58:24 [WARN] raft: Heartbeat timeout from “” reached, starting election
2017/11/12 12:58:24 [INFO] raft: Node at 127.0.0.1:8300 [Candidate] entering Candidate state in term 2
2017/11/12 12:58:24 [DEBUG] raft: Votes needed: 1
2017/11/12 12:58:24 [DEBUG] raft: Vote granted from b790b43d-ab83-26f6-4d43-b4b95511db28 in term 2. Tally: 1
2017/11/12 12:58:24 [INFO] raft: Election won. Tally: 1
2017/11/12 12:58:24 [INFO] raft: Node at 127.0.0.1:8300 [Leader] entering Leader state
2017/11/12 12:58:24 [INFO] consul: cluster leadership acquired
2017/11/12 12:58:24 [DEBUG] consul: Skipping self join check for “instance-1” since the cluster is too small
2017/11/12 12:58:24 [INFO] consul: member ‘instance-1’ joined, marking health alive
2017/11/12 12:58:24 [INFO] consul: New leader elected: instance-1
2017/11/12 12:58:24 [INFO] agent: Synced node info
^C 2017/11/12 12:58:56 [INFO] Caught signal: interrupt
2017/11/12 12:58:56 [INFO] Graceful shutdown disabled. Exiting
2017/11/12 12:58:56 [INFO] agent: Requesting shutdown
2017/11/12 12:58:56 [INFO] consul: shutting down server
2017/11/12 12:58:56 [WARN] serf: Shutdown without a Leave
2017/11/12 12:58:56 [WARN] serf: Shutdown without a Leave
2017/11/12 12:58:56 [INFO] manager: shutting down
2017/11/12 12:58:56 [INFO] agent: consul server down
2017/11/12 12:58:56 [INFO] agent: shutdown complete
2017/11/12 12:58:56 [INFO] agent: Stopping DNS server 127.0.0.1:8600 (tcp)
2017/11/12 12:58:56 [INFO] agent: Stopping DNS server 127.0.0.1:8600 (udp)
2017/11/12 12:58:56 [INFO] agent: Stopping HTTP server 127.0.0.1:8500 (tcp)
2017/11/12 12:58:56 [INFO] agent: Waiting for endpoints to shut down
2017/11/12 12:58:56 [INFO] agent: Endpoints down
2017/11/12 12:58:56 [INFO] Exit code: 1

[root@instance-1 ~]# consul agent -dev &
[1] 1485

[root@instance-1 consul.d]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8300 0.0.0.0:* LISTEN 1576/consul
tcp 0 0 127.0.0.1:8301 0.0.0.0:* LISTEN 1576/consul
tcp 0 0 127.0.0.1:8302 0.0.0.0:* LISTEN 1576/consul
tcp 0 0 127.0.0.1:8500 0.0.0.0:* LISTEN 1576/consul
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1077/sshd
tcp 0 0 127.0.0.1:8600 0.0.0.0:* LISTEN 1576/consul
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1124/master
tcp6 0 0 :::22 :::* LISTEN 1077/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1124/master

[root@instance-1 ~]# consul members
2017/11/12 13:00:08 [DEBUG] http: Request GET /v1/agent/members?segment=_all (145.773µs) from=127.0.0.1:35254
Node Address Status Type Build Protocol DC Segment
instance-1 127.0.0.1:8301 alive server 1.0.0 2 dc1 <all>

 

 

Leave a comment