Process: 7127 ExecStop=/usr/local/bin/redis-cli shutdown (code=exited, status=0/SUCCESS) Loaded: loaded (/etc/systemd/system/rvice enabled vendor preset: enabled)Īctive: active (running) since Wed 11:42:00 EDT 5min 03s ago To check the services running with no errors we can run the below command – # systemctl status redis We are ready to start the Redis Server # systemctl start redis # chmod 770 /var/lib/redis Start and Test Redis Restart=always WantedBy=multi-user.target Creating Redis User,Group and Directories # add users -system -group -no-create-home redis Description=Redis In-Memory Data Store After=network.target section, we define the systemd to target the service to attach toĮnable (configured to start at boot time). etc/redis/nf ExecStop=/usr/local/bin/redis-cli shutdown User=redis Group=redis ExecStart=/usr/local/bin/redis-server To stop the service we will use Redis shutdown command and which will be executed with redis-cli binary. To start the services we need to call the redis-server binary which is pointed at our configuration. We will dedicate a user and group which will call the Redis with simplicity. For security reasons, we will not run the service as root user. In section we will specify the services behavior. We start with section by adding the description and define a requirement that we needed networking to be the most available to start this service. We can create a systemd file so that init system can manage the process. Save the changes and close the file Create a systemd Unit file for Redis
# Note that you must specify a directory here, not a file name. # The Append Only File will also be created inside this directory. # above using the 'dbfilename' configuration directive. # The DB will be written inside this directory, with the filename specified This location has the write permission and is not viewable by normal users. Next, find the dir directive and change the dire directive to the /var/lib/redis, where this option is used to specify the directory that Redis will be used to dump the persistent data. # They do not enable continuous liveness pings back to your supervisor. # Note: these supervision methods only signal "process is ready." # UPSTART_JOB or NOTIFY_SOCKET environment variables # supervised auto - detect upstart or systemd method based on
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET # supervised upstart - signal upstart by putting Redis into SIGSTOP mode # supervised no - no supervision interaction # If you run Redis from upstart or systemd, Redis can interact with your In the configuration file, we will find a directive called ‘supervised’ which is set to no, as we are using systemd to init the system so that we can change this to systemd. Open the configuration file using an editor # vi /etc/redis/nf
We needed to create the directory /etc/redis # mkdir /etc/redisĬopy the redis configuration files included in the Redis source archive # cp /tmp/redis/redis-stable/nf /etc/redis
# make install Configure Redis on UbuntuĪs we just installed the Redis, we can begin the configuration of Redis. We can install all the binaries on the system using the below command. We will compile and install the Redis binaries with the below command # makeĪfter the compilation of the source code, we will get binaries we run the below command to test the suit # make test Create a folder in temp # mkdir /tmp/redisĭownload the latest stable version of Redis, thus we can get using the below command # curl -O
# sudo apt-get install build-essentials tcl Redis Download, Compile & Installĭownloading the Source code and Extract. We also need to install build-essential meta-package from the Ubuntu repositories, and download ‘tcl’ packages which are used to test the binaries.
For that, we needed to install the dependencies for the software compiling. To get the latest version of Redis, we will get the latest source code and will compile and install the software. To do this demo we need a non-root user and we will set Sudo privileges to the user to perform. We will configure this on the Ubuntu Linux server.
In this article we will learn how to configure Redis, Redis is an in-memory Key-value store which is popular for its flexibility, performance and used with wide language support.