Alibaba Cloud install redis
download
- Official download
https://redis.io/download
- wget download ( wget introduction )
wget http://download.redis.io/releases/redis-6.0.6.tar.gz
Unzip
- The official download needs to be transferred to the linux system through rz or other methods
- Create a redis folder under usr/local, move the downloaded or rz uploaded file to usr/local/redis, or directly upload rz or wget download in this directory
- Unzip
tar xzf redis-6.0.6.tar.gz
, and then there will be a folder for redis-6.0.6 under usr/local/redis
Compile and install
Enter the folder cd redis-6.0.6
make
to compile, there will be some more executable files under redis-6.0.6/src, such as redis-server, redis-cli and other
make install
installations. This is the default installation used, so there are a few more under usr/local/bin A redis executable file
before
installation and after installation (a few more redis executable files)
Change setting
- daemonize Whether to start with a daemon thread, the default is no, which means that the redis process will be closed when exiting or closing the connection; yes means that the process daemon is turned on, and it will run in the background until the
cd usr/local/redis/redis-6.0.6
vim redis-conf
specified location is manually stopped , and enter i to enter the insert editing mode , Change to yes, and then press esc to exit the editing mode.
Enter ":wq" and press Enter, save and exit
- If other machines need access, you need to comment or modify the bound bind 127.0.0.1 to 0.0.0.0; and add access rules on Alibaba Cloud
- Other references can refer to the following table or rookie tutorial
Sex meaning daemonize no Redis does not run as a daemon by default. You can modify this configuration item to enable the daemon with yes (Windows does not support the configuration of daemon threads as no) location 6379 Specify the Redis listening port, the default port is 6379 bind 127.0.0.1 Bound host address requirepass foobared Set the Redis connection password. If the connection password is configured, the client needs to provide the password through the AUTH command when connecting to Redis, which is closed by default
Start method
- Start by default (bind 127.0.0.1 can only be local, no password) to
redis-server
start the redis service.
redis-cli
Start the client and reopen an xshell connection for testing.
redis-cli shutdown
Close the redis service - Specify the configuration file to start
redis-server usr/local/redis/redis-6.0.6/redus.conf
- The script content of redis_init_script
which comes with redis_init_script to automatically start under redis-6.0.6/utils
is as follows:
Create a redis folder under /etc,#!/bin/sh # # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. ### BEGIN INIT INFO # Provides: redis_6379 # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Redis data structure server # Description: Redis data structure server. See https://redis.io ### END INIT INFO REDISPORT=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${ REDISPORT}.pid CONF="/etc/redis/${REDISPORT}.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -p $REDISPORT shutdown while [ -x /proc/${ PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *) echo "Please use start or stop as first argument" ;; esac
cd etc
switch to the etc directory,
mkdir redis
create a redis folder,
cp /usr/local/redis/redis-6.0.6/redis.conf /etc/redis/6379.conf
copy the modified configuration file to etc/redis and rename it to 6379.conf
cp /usr/local/redis/redis-6.0.6/utils/redis_init_script /etc/init.d/redis
redis_init_script to automatically start the script under etc/init.d/ and rename it to redis
chkconfig redis on
set at startup redis service, Ali cloud services purchased using the restart after viewing redis process, the configuration is complete
addition can be closed manually open and close from the start redis service
chkconfig redis off
set the boot does not start automatically redis service
service redis start
open redis service
service redis stop
closed redis service
stop
-
Check the redis service status,
ps aux|grep redis
you can see that the redis-server is running
-
Stop the redis service
redis-cli shutdown
without setting the redis password to use.
redis-cli -a password shutdown
Set the redis password to use, here password is replaced with the password you set (if you set the password and use redis-cli shutdown, it will report "NOAUTH Authentication required") -
Again,
ps aux|grep redis
you can see that the redis service has stopped
Uninstall
- Delete several redis files generated by make installation
- Delete the downloaded redis and the decompressed redis file
Debugging tool (Redis free client Another Redis DeskTop Manager)
Reference connection:
Three ways to
start
Redis Configure redis under Linux to automatically start Redis installation and uninstall Redis installation and uninstallation in
Linux
Add link description
linux install redis complete steps Alibaba
Cloud install redis and remotely connect to
CentOS7 install Redis
linux install redis complete steps