Create Redis database on Docker

Pre-requisite#

Ensure that Docker is installed in your system.

If you're new, refer https://docs.docker.com/docker-for-mac/install/ to install Docker on Mac.

To pull and start the Redis Enterprise Software Docker container, run this docker run command in the terminal or command-line for your operating system.

Note: On Windows, make sure Docker is configured to run Linux-based containers.

docker run -d --cap-add sys_resource --name rp -p 8443:8443 -p 9443:9443 -p 12000:12000 redislabs/redis

In the web browser on the host machine, go to https://localhost:8443 to see the Redis Enterprise Software web console.

Step 1: Click on “Setup”#

Click Setup to start the node configuration steps.

My Image

Step 2: Enter your preferred FQDN#

In the Node Configuration settings, enter a cluster FQDN such as demo.redislabs.com. Then click Next button.

My Image

Enter your license key, if you have one. If not, click the Next button to use the trial version.

Step 3: Enter the admin credentials#

Enter an email and password for the admin account for the web console.

My Image

These credentials are also used for connections to the REST API. Click OK to confirm that you are aware of the replacement of the HTTPS SSL/TLS certificate on the node, and proceed through the browser warning.

Step 4: Create a Database:#

Select “redis database” and the “single region” deployment, and click Next.

My Image

Enter a database name such as demodb and click Activate to create your database

My Image

You now have a Redis database!

Step 5: Connecting using redis-cli#

After you create the Redis database, you are ready to store data in your database. redis-cli is a built-in simple command-line tool to interact with Redis database. Run redis-cli, located in the /opt/redislabs/bin directory, to connect to port 12000 and store and retrieve a key in database1

$ docker exec -it rp bash
redislabs@fd8dca50f905:/opt$
/opt/redislabs/bin/redis-cli -p 12000
127.0.0.1:12000> auth <enter password>
OK
127.0.0.1:12000> set key1 123
OK
127.0.0.1:12000> get key1
"123"

Next Step#