Any one with a sample of running rancher server with external db

any one with a sample of running rancher server with external db

or if I don’t use external db, what happens if I move my rancher server in another host, will it still track the added host or it will start a fresh.

@mwaaas Are you bind mounting a host volume for Rancher-Server when you start that container?

At a minimum this is the easiest way to “move” the Rancher Server somewhere else.
All you would need to do is move the directory on the host that was mounted for Rancher with it.

i.e.
docker run -d -v /dockervols/rancher:/var/lib/mysql --restart=always -p 8080:8080 rancher/server:latest
This will end up mounting:
/dockervols/rancher on the host
to:
/var/lib/mysql in the Rancher Server container

With that everything done in the Rancher Server web interface would be stored in that directory on the host and can/could be moved with Rancher Server to retain settings etc.

As for using an external database the steps are relatively straightforward and can be broken down as:

  1. Set up your external DB location

  2. Export your current Rancher DB

  3. Import that into the external DB

  4. Relaunch Rancher Server using the new external DB

These steps along with an easy to use DB export button and relaunch config can be followed by going to the HA section in the Rancher Server web interface:
Under the “Admin” Drop-down >> Select “High-Availability”

Here is a sample rancher server docker run using an external AWS Aurora RDS DB -

sudo docker run -d --restart=always -p 8080:8080 -e CATTLE_DB_CATTLE_MYSQL_HOST=xxx.us-east-1.rds.amazonaws.com -e CATTLE_DB_CATTLE_MYSQL_PORT=3306 -e CATTLE_DB_CATTLE_MYSQL_NAME=cattle -e CATTLE_DB_CATTLE_USERNAME=xxx -e CATTLE_DB_CATTLE_PASSWORD=xxx rancher/server:v1.2.0-pre2