Enter below command, $ sudo systemctl enable rvice Next enable Redis to start on System boot. Let’s install redis by using below command. In redis, we can configure single data base structure and replication (Master-Slave) too. It supports different data structures such as string, lists, sorted sets with range queries and etc. Message brokers are building block of message-orianted-middleware(MOM), which transfers, route, respond, invoke and interact with sender/receiver end. Redis is an open source tools, which is used as a database and acts as in-memory data structure store, cache and message broker. Step 4: Start, Restart, Stop Redis Server.
#Ubuntu install redis how to
To learn more about how to use Redis, visit Redis’s official documentation page. This output confirms that the master/slave replication setup is working properly. Next, run redis-cli on the slave node and execute get 'name', which should return the same value as that on the master. redis-cliĮxit from redis-cli prompt by typing exit or pressing Ctrl-C. On your master node, run redis-cli and execute command set 'name' Raj. Systemctl restart redis-server Verify Reds Master/Slave Replication # CentOS 7 / RHEL 7 #Īgain replace 192.168.1.10 with the master node IP address. Step 1: Install Redis Step 2: Configure Remote Access On Slave NodeĬonfigure a slave instance by adding the replicaof directive into nf to set up the replication. PONG Set Up Redis Master/Slave Replication On Master Node To verify that remote access is set up properly, you can try to ping the Redis server from your remote machine using the redis-cli (command-line interface). Run the following commands in the terminal firewall-cmd -permanent -add-port=6379/tcpįirewall-cmd -reload Verify Remote Access You will have to add a firewall rule that allows traffic from remote machines to the Redis server on TCP port 6379 in case you have enabled remote access. READ: netstat Command not found on Debian / Ubuntu / Linux Mint – Quick Fix Firewall (CentOS / RHEL) READ: netstat Command not found on CentOS 7 / RHEL 7 – Quick Fix Use the following netstat command to verify that the Redis server is listening on your server interface on port 6379. Restart the Redis server for changes to take effect. # CentOS 7 / RHEL 7 #įind the line that starts with bind 127.0.0.1 and add your server IP address after 127.0.0.1. Perform the below steps only if you want to connect to your Redis server from remote hosts.Įdit the Redis configuration file. You can connect to the Redis only from 127.0.0.1 (localhost) – the machine where Redis is running.
Configure Redis Remote Access (Optional)īy default, Redis doesn’t allow remote connections. You now have Redis running on your server. If Redis is running, it will return a PONG. Verify that Redis is running with redis-cli (command line interface of Redis). Nov 28 06:57:30 redisc7 systemd: Started Redis persistent key-value database. Nov 28 06:57:30 redisc7 systemd: Starting Redis persistent key-value database.
Loaded: loaded (/usr/lib/systemd/system/rvice enabled vendor preset: disabled)ĭrop-In: /etc/systemd/system/Īctive: active (running) since Wed 06:57:30 UTC 14s ago