Start Vitess Cluster Using Docker Image

566 views
Skip to first unread message

Bhawna Faujdar

unread,
Aug 10, 2016, 9:12:54 AM8/10/16
to vitess
Hi,

I am trying to build Vitess using docker base image , as indicated in the user guide. 

$ sudo docker run -ti vitess/base bash
vitess@user:/vt/src/github.com/youtube/vitess $make build

I am able to start the cluster , start the vttables, vtdata and all , but vi, sudo commands are not found. I am not able to install them as well, since yum is not installed, and to install it I need to be the root. 

su -
Password - 

What is the password that I am supposed to use here? I need root access. Is it any vitess user specific password? Am I missing something too basic? I am inside vitess@user:/vt/src/github.com/youtube/vitess

Any help would be appreciated.

Thanks,

Bhawna

Anthony Yeh

unread,
Aug 10, 2016, 10:37:05 PM8/10/16
to vitess
Hi Bhawna,

In general, our Docker images are meant for use during packaging and deployment - for building finalized code and running it in a containerized environment.

We didn't plan for the images to be used for active development (editors, etc.) or for interactive logins (sudo). Usually you would edit files on your workstation, then build the Docker images as part of the packaging phase.

With that said, it is possible to get root access within the image. The easiest way is to just run the 'vitess/root' image rather than 'vitess/base'. You can also pass '-u root' as a flag to the 'docker run' command. There is no password set for root in the image, so password-based login does not work.

If you don't mind sharing the higher-level goal you're trying to achieve (starting a cluster to experiment with? editing configs? making code changes and rebuilding?), we can elaborate on the recommended workflow.

Thanks,
Anthony

--
You received this message because you are subscribed to the Google Groups "vitess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vitess+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bhawna Faujdar

unread,
Aug 11, 2016, 2:29:41 AM8/11/16
to vitess
Anthony,

Thanks for a quick reply. The higher level goal is to be able to migrate our mysql environment to Vitess. As a first step,  I wanted to set up a vitess cluster with a database and couple of replicas, insert a good amount of data in the database, and try reading it to see how much time it takes compared to mysql. I am doing the setup in CentOS. I tried the manual build, but it fails in the bootstrap phase with the error - A variable was shadowed. (Warnings are treated as errors for gcc, and I was not able to set the default option to avoid warnings being treated as errors, during the bootstrap) The build with docker image worked and I was able to start the cluster, vtttables, vtgate, zookeepers, and run the client.sh file. So, I wanted to add a .sql file in /examples/local and insert some data of my own in the client.py file, and read that from the replica, which I couldn't do without being the root. 

If you have suggestions regarding how I should proceed for my usecase, please do let me know. 

Thanks,
Bhawna 

Michael Berlin

unread,
Aug 11, 2016, 4:52:49 AM8/11/16
to vitess
Hi Bhawna,

On Wed, Aug 10, 2016 at 11:29 PM, Bhawna Faujdar <bhawna....@gmail.com> wrote:
Anthony,

Thanks for a quick reply. The higher level goal is to be able to migrate our mysql environment to Vitess. As a first step,  I wanted to set up a vitess cluster with a database and couple of replicas, insert a good amount of data in the database, and try reading it to see how much time it takes compared to mysql. I am doing the setup in CentOS. I tried the manual build, but it fails in the bootstrap phase with the error - A variable was shadowed. (Warnings are treated as errors for gcc, and I was not able to set the default option to avoid warnings being treated as errors, during the bootstrap)

Can you please paste the full error?

My guess is the error comes from compiling the gRPC library and not from compiling the Vitess Go code.

Which CentOS version are you using?

Currently, we don't provide binaries for Vitess (except the Docker images). Note that the Docker images are based on Debian and they are minimal to keep the size down. Therefore, "yum" does not work. You need to use "apt-get" instead to install packages.

For maximum flexibility, it would probably be good if you could successfully run bootstrap.sh on your CentOS host. Alternatively, I suggest to use the binaries from our provided Docker images. Note that you can mount a host directory as a data volume in Docker. This way, you can make data like your .sql file in the Docker instance available.
 
The build with docker image worked and I was able to start the cluster, vtttables, vtgate, zookeepers, and run the client.sh file. So, I wanted to add a .sql file in /examples/local and insert some data of my own in the client.py file, and read that from the replica, which I couldn't do without being the root. 

If you have suggestions regarding how I should proceed for my usecase, please do let me know. 

Please try Anthony's suggestions:

With that said, it is possible to get root access within the image. The easiest way is to just run the 'vitess/root' image rather than 'vitess/base'. You can also pass '-u root' as a flag to the 'docker run' command. There is no password set for root in the image, so password-based login does not work.

Cheers,
Michael

To unsubscribe from this group and stop receiving emails from it, send an email to vitess+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages