Master:-
To get more details about any node run the inspect command like below for Worker01
[root@ip-172-31-40-90 ~]# docker node inspect u9sg7rw8yvb75o5ybrnppeglo
[
{
"ID": "u9sg7rw8yvb75o5ybrnppeglo",
"Version": {
"Index": 33
},
"CreatedAt": "2019-07-24T09:41:36.258168494Z",
"UpdatedAt": "2019-07-24T09:41:36.330025943Z",
"Spec": {
"Labels": {},
"Role": "worker",
"Availability": "active"
},
"Description": {
"Hostname": "ip-172-31-43-91",
"Platform": {
"Architecture": "x86_64",
"OS": "linux"
},
"Resources": {
"NanoCPUs": 1000000000,
"MemoryBytes": 1033723904
},
"Engine": {
"EngineVersion": "18.06.1-ce",
-----------------------------------------------------------------------------------------
Now to Promote(Master) any node run the below command (promoted both worker node as master)
[root@ip-172-31-40-90 ~]# docker node promote af3y6rhgp328s777kw26g7co2 u9sg7rw8yvb75o5ybrnppeglo
Node af3y6rhgp328s777kw26g7co2 promoted to a manager in the swarm.
Node u9sg7rw8yvb75o5ybrnppeglo promoted to a manager in the swarm.
[root@ip-172-31-40-90 ~]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
af3y6rhgp328s777kw26g7co2 ip-172-31-35-189 Ready Active Reachable 18.06.1-ce
rby7qdb8hc3ebuuy78vpl0i4v * ip-172-31-40-90 Ready Active Leader 18.06.1-ce
u9sg7rw8yvb75o5ybrnppeglo ip-172-31-43-91 Ready Active Reachable 18.06.1-ce
[root@ip-172-31-40-90 ~]#
Worker01:-
Worker02:-
To get more details about any node run the inspect command like below for Worker01
[root@ip-172-31-40-90 ~]# docker node inspect u9sg7rw8yvb75o5ybrnppeglo
[
{
"ID": "u9sg7rw8yvb75o5ybrnppeglo",
"Version": {
"Index": 33
},
"CreatedAt": "2019-07-24T09:41:36.258168494Z",
"UpdatedAt": "2019-07-24T09:41:36.330025943Z",
"Spec": {
"Labels": {},
"Role": "worker",
"Availability": "active"
},
"Description": {
"Hostname": "ip-172-31-43-91",
"Platform": {
"Architecture": "x86_64",
"OS": "linux"
},
"Resources": {
"NanoCPUs": 1000000000,
"MemoryBytes": 1033723904
},
"Engine": {
"EngineVersion": "18.06.1-ce",
-----------------------------------------------------------------------------------------
Now to Promote(Master) any node run the below command (promoted both worker node as master)
[root@ip-172-31-40-90 ~]# docker node promote af3y6rhgp328s777kw26g7co2 u9sg7rw8yvb75o5ybrnppeglo
Node af3y6rhgp328s777kw26g7co2 promoted to a manager in the swarm.
Node u9sg7rw8yvb75o5ybrnppeglo promoted to a manager in the swarm.
[root@ip-172-31-40-90 ~]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
af3y6rhgp328s777kw26g7co2 ip-172-31-35-189 Ready Active Reachable 18.06.1-ce
rby7qdb8hc3ebuuy78vpl0i4v * ip-172-31-40-90 Ready Active Leader 18.06.1-ce
u9sg7rw8yvb75o5ybrnppeglo ip-172-31-43-91 Ready Active Reachable 18.06.1-ce
[root@ip-172-31-40-90 ~]#
Now we can run any command(like ls) on any node because both worker node become as master also
-------------------------------------------------------------------------------------------------------
Likewise we can Demote(Worker) any node just change promote command to demote
[root@ip-172-31-40-90 ~]# docker node demote af3y6rhgp328s777kw26g7co2 u9sg7rw8yvb75o5ybrnppeglo
Manager af3y6rhgp328s777kw26g7co2 demoted in the swarm.
Manager u9sg7rw8yvb75o5ybrnppeglo demoted in the swarm.
[root@ip-172-31-40-90 ~]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
af3y6rhgp328s777kw26g7co2 ip-172-31-35-189 Ready Active 18.06.1-ce
rby7qdb8hc3ebuuy78vpl0i4v * ip-172-31-40-90 Ready Active Leader 18.06.1-ce
u9sg7rw8yvb75o5ybrnppeglo ip-172-31-43-91 Ready Active 18.06.1-ce
[root@ip-172-31-40-90 ~]#
Worker01:-
Worker02:-
No comments:
Post a Comment