Log in to the Linux server as the root user.
1.Run the mkdir command to create a directory under the /opt directory to place the installation package. For example, netbraintemp.
3.Run the cd /opt/netbraintemp command to navigate to the /opt/netbraintemp directory.
4.Download the installation package.
▪Option 1: If the Linux server has no access to the Internet, obtain the redis-linux-x86_64-rhel7-5.0.4-8.0.2.tar.gz file from NetBrain and then upload it to the /opt/netbraintemp directory by using a file transfer tool.
▪Option 2: If the Linux server has access to the Internet, run the
wget <download link> command under the /opt/netbraintemp directory to directly download the redis-linux-x86_64-rhel7-5.0.4-8.0.2.tar.gz file from NetBrain official download site.
Note: Contact NetBrain Support Team to get the download link. The download link is case-sensitive.
Tip: Run the yum -y install wget command to install the wget command if it has not been installed on the server.
5.Run the tar -zxvf redis-linux-x86_64-rhel7-5.0.4-8.0.2.tar.gz command under the /opt/netbraintemp directory to extract installation files.
[root@localhost netbraintemp]# tar -zxvf redis-linux-x86_64-rhel7-5.0.4-8.0.2.tar.gz
redis/
redis/config/
...
redis/config/setup.conf
...
redis/install.sh
...
6.Run the cd redis/config/ command to navigate to the config directory.
7.Modify the parameters in the setup.conf file located under the config directory and save the changes. For how to modify the configuration file, refer to Editing a File with VI Editor.
[root@localhost config]# vi setup.conf
#Redis configuration file
#Note= Other than the username and password, other entries
#can only contain letters and numbers, and should start with a letter.
#Account info.Password should not contain: {}[]:",'|<>@&^%\ or a space. Password should be same
in all nodes if the mode is cluster.
Password=admin
# Mode use 'standalone' if single installation, use 'cluster' if HA mode
Mode=standalone
# Port is used to start the redis service on specified port. We use default port 6379.
Port=6379
# Data Path is used to store redis files. Default path /var/lib/redis/.
DataPath=/var/lib/redis/
# Log Path is used to store redis log files. Default path /var/log/redis/.
LogPath=/var/log/redis/
# Role (NodeRole can only be 'master' or 'slave'. sentinel will be installed onto slave node)
NodeRole=master
#Master Node (Master Node can support ip address or FQDN and is used if the Mode is cluster and
used in slave node)
MasterNode=
# Sentinel Port is used to start the redis sentinel service on specified port. We use default port 6380.
this is needed only for slave node.
SentinelPort=6380
# Resource limitation. It can only be 'yes' or 'no'
ResourceLimit=no
# CPU Limit. should be specified as %. Range is 1% to 100%
CPULimit=100%
#Memory Limit. should be specified as %. Range is 1% to 100%
MemmoryLimit=100%
# TLS. It can only be 'yes' or 'no'
UseSSL=no
Certificate=/etc/ssl/redis-server.crt
PrivateKey=/etc/ssl/redis-server.pem
# Stunnel Port is used to start the stunnel service on specified port. We use default port 7000.
StunnelPort=7000
# Stunnel Sentinel Port is used to start the redis sentinel service on specified port.
We use default port 7001 for SSL. this is needed only for slave node.
StunnelSentinelPort=7001
8.Run the cd .. command to navigate to the redis directory.
9.Run the ./install.sh script under the redis directory to install Redis.
[root@localhost redis]# ./install.sh
INFO: checking root
INFO: Creating log file
INFO: checking date
INFO: Preprocessing SUCCEEDED
INFO: Starting to check system
Collecting system information...
...
Collecting system information SUCCEEDED.
INFO: Starting to check Linux OS info
INFO: Starting to check rpm exists
INFO: Starting to check systemd
INFO: Starting to check required CPU
INFO: Starting to check minimum memory
INFO: System checking SUCCEEDED
INFO: Dependent packages checking SUCCEEDED
INFO: checking password
INFO: checking useSSL
INFO: checking ResourceLimit
INFO: checking Port
INFO: Mode is standalone
INFO: Role of node is master
INFO: Port 6379 is available
INFO: Add port 6379 into firewall successfully
INFO: Configuration parameters checking SUCCEEDED
INFO: Installing /opt/netbraintemp/redis/sources/redis-5.0.4-1.e17.x86_64.rpm
Preparing... ########################################
Updating / installing...
redis-5.0.4-1.el7 ########################################
INFO: Official rpm package installing SUCCEEDED
INFO: Configuration parameters updating SUCCEEDED
INFO: Permission assigning SUCCEEDED
vm.overcommit_memory = 1
net.core.somaxconn = 1024
never /sys/kernel/mm/transparent_hugepage/enabled
redis.service - Redis
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-01-14 00:38:49 EST; 37min ago
Main PID: 56299 (redis-server)
Memory: 1.2M
CGroup: /system.slice/redis.service
56299 /sbin/redis-server *:6379
May 05 03:19:26 localhost.localdomain systemd[1]: Started Redis.
INFO: Checking redis Status :
Active: active (running) since Tue 2020-01-14 00:38:49 EST; 37min ago
INFO: Verification SUCCEEDED
INFO: Successfully installed Redis
INFO: Backup uninstall.sh SUCCEEDED
10. Run the systemctl status redis command to verify whether its service starts successfully.
[root@localhost ~]# systemctl status redis
redis.service - Redis
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-01-14 00:38:49 EST; 37min ago
Main PID: 52318 (redis-server)
Memory: 7.7M
...
Note: When your disk space is insufficient for large amounts of logs, you can modify the log settings in the redis.conf file under the /etc/logrotate directory.
Tip: It is highly recommended to run the rm -rf /opt/netbraintemp/redis/config/setup.conf command to delete the setup.conf file from the server after Redis is successfully installed because the file may cause security vulnerability.
The following table describes the parameters that can be configured when installing Redis.
Parameter |
Default Value |
Description |
---|---|---|
Password |
admin |
Specify the admin password used to connect to Redis. Note: The password cannot contain any of the following special characters, and its length cannot exceed 64 characters. Note: Each member in a cluster must have the same password. |
Mode |
standalone |
Set whether to enable cluster deployment. Keep the default value for a standalone deployment. If you plan to deploy a cluster, modify it to cluster. |
Port |
6379 |
Specify the port number that the master Redis node listens to. |
DataPath |
/var/lib/redis/ |
Specify the storage path for all data files of Redis. |
LogPath |
/var/log/redis/ |
Specify the storage path for all log files of Redis. |
NodeRole |
master |
Set the role for the current node. Available options are master, slave, and sentinel. Keep the default value for a standalone deployment. If you plan to deploy a cluster, modify it to slave and sentinel on the other nodes. |
MasterNode |
|
This parameter is only required for cluster deployments. Enter the IP address of the master node when you configure the setting for the slave and sentinel node. |
SentinelPort |
6380 |
The port number that the slave or sentinel Redis node listens to. |
ResourceLimit |
no |
Set whether to limit the system resource usage for Redis. |
CPULimit |
100% |
The maximum CPU utilization of the machine that can be consumed by Redis. |
MemoryLimit |
100% |
The maximum memory capacity of the machine that can be consumed by Redis. |
UseSSL |
no |
Set whether to enable the encrypted connections to Redis by using SSL. Note: Redis itself does not support SSL. It uses stunnel as an SSL service agent. Stunnel will be automatically installed together with Redis. |
Certificate |
/etc/ssl/redis-server.crt |
Specify the storage path for all the certificates and key files used for SSL authentication. Note: It is required only if UseSSL is enabled. |
PrivateKey |
/etc/ssl/redis-server.pem |
Specify the name of SSL private key file. Note: It is required only if UseSSL is enabled. |
StunnelPort |
7000 |
Specify the port number for stunnel to establish an SSL encrypted tunnel on the master and slave Redis node. Note: It is required only if UseSSL is enabled. |
StunnelSentinelPort |
7001 |
Specify the port number for stunnel to establish an SSL encrypted tunnel on the sentinel Redis node. Note: It is required only if UseSSL is enabled. |