Search code examples
dockerdocker-composeportsinglestore

Changing memSQL default aggregator port when running memSQL via docker


I am trying to use MemSQL via docker container.
Below is my Docker-compose.yml entry for the memsql docker

memsql:
image: memsql/quickstart
volumes:
  - "./jenkins/jenkins_memsql_schema.sql:/schema.sql"
ports:
  - "3307:3306"
  - "9000:9000"
hostname: memsql
container_name: memsql

The default port that memsql runs on is 3306. I would like to change this default port.
When I raise this container and try to change the port from within the container.
I use the following command:

memsql-ops memsql-update-config --key=port --value=3307

I get the following error:

You cannot change the port variable for an existing MemSQL node.

So:

  1. It seems you cannot change the port once memSQL is running, so how do you change it before?
  2. How can this be set via the docker-compose setup?

Solution

  • In the context of MemSQL running in Docker, the easiest way is to leave MemSQL running on port 3306 within the docker container, but have a different host port map to that port.

    In a non-Docker install you can choose the port to install MemSQL on during installation (--port option to https://docs.memsql.com/memsql-tools-reference/latest/create-node/). It is also possible to change the port of a node by removing and re-adding it with the desired port - memsql-update-config cannot be used for this.