# Cannot add multiple hosts in rancher server

**URL:** https://forums.suse.com/t/cannot-add-multiple-hosts-in-rancher-server/4965
**Category:** Rancher 1.x
**Created:** [December 20, 2016, 10:00am UTC](https://forums.suse.com/t/cannot-add-multiple-hosts-in-rancher-server/4965 "2016-12-20T10:00:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![qingdaojunzuo](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/qingdaojunzuo/32/1969_2.png) [@qingdaojunzuo](https://forums.suse.com/u/qingdaojunzuo)
#### Post date: [December 20, 2016, 10:00am UTC](https://forums.suse.com/t/cannot-add-multiple-hosts-in-rancher-server/4965/1 "2016-12-20T10:00:52Z")

</div>

I have encountered an issue when adding multiple hosts to rancher server.

The issue is that the first added host works well in rancher server from GUI and the first one will be removed automatically when I adding a new host to rancher. It seems that the first host has been replaced by the second one.

The steps for adding hosts,

- run the latest rancher server docker image using single mode
- add a new environment with kubenetes
- change to the new environment and click ‘add host’, copy the command and run on the minion server
- do the same action as item 3 on minion server 2

The VM I used is,

- Rancher version v1.2.1
- Linux 4.2.0-27-generic #32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC 2016 x86\_64 x86\_64 x86\_64 GNU/Linux
- Docker version 1.12.5, build 7392c3b

All the VMs are copied from one VM template and I did,

- change the host name in each VM(modified the file /etc/hosts and /etc/hostname) and reboot
- stop the docker service by “service docker stop”
- remove all the docker lib files under /var/lib/docker to keep it clean
- remove all the iptables by “iptables -F”
- start the docker service

I checked the docker running containers after the first host had been removed automatically,

- On first minion,  
`1. rancher agent exits by 137`  
7052c81844b6 rancher/agent:v1.1.1 “/run.sh run” 41 minutes ago Exited (137) 22 minutes ago

- On second minion,  
`1. rancher agent starts successfully`  
f42c19a95b60 rancher/agent:v1.1.1 “/run.sh run” 29 minutes ago Up 29 minutes rancher-agent

- On the rancher server,  
`1. The logs when adding second host`

I also tried to install rancher 1.1.4 and 1.2.0, the issue also exists.

I am new for rancher and currently I have no idea about this. Have anyone encountered this issue before or Could you please help to tell me how can I resolve this issue?

Thanks for your help.

---

<div class="post-metadata">

### Author: ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)
#### Post date: [December 20, 2016, 5:18pm UTC](https://forums.suse.com/t/cannot-add-multiple-hosts-in-rancher-server/4965/2 "2016-12-20T17:18:31Z")

</div>

`/var/lib/rancher/state` contains a UUID that identifies the host, so when you add a 2nd one we think it’s the same as the one that already exists and it replaces it. `rm -rf` it as part of your template prep.

---

<div class="post-metadata">

### Author: ![qingdaojunzuo](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/qingdaojunzuo/32/1969_2.png) [@qingdaojunzuo](https://forums.suse.com/u/qingdaojunzuo)
#### Post date: [December 21, 2016, 3:02am UTC](https://forums.suse.com/t/cannot-add-multiple-hosts-in-rancher-server/4965/3 "2016-12-21T03:02:49Z")

</div>

@vincent, thanks, really appreciate your help. I removed the files on VMs and it works well now. 🙂

BTW, is there any documentation related to the implementation details of rancher so that we can follow? Thanks again.
