Redis configuration
After the server restarts, the command not found is basically hit to solve the problem of
export PATH=/bin:/usr/bin:$PATH
1. Download Redis and upload it to the server folder
First download Redis version 7.0 or above from the official website , and the recommended version suffix is a stable version with an even number
- Then upload the downloaded file to
/opt
the folder of the server, here directly use the pagoda panel to upload and decompress
2. Install Redis
Enter /opt/redis-7.0.9
the folder and enter the command
make && make install
Just wait for the installation to succeed. The default installation path is/usr/local/bin
- redis-benchmark: a performance testing tool, run this command after the service starts to see how your notebook performs
- redis-check-aof: repair problematic AOF files, rdb and aof will be discussed later
- redis-check-dump: fix buggy dump.rdb files
- redis-cli: client, operation entry
- redis-sentinel: Redis cluster use
- redis-server: Redis server startup command
3. Modify the configuration file
- First copy the default redis.conf to a path defined by yourself, such as /myredis B
mkdir /myredis
cp redis.conf /myredis/redis7.conf
- Modify the redis.conf configuration file in the /myredis directory for initialization settings
cd /myredis/
vim redis7.conf
-
1. The default
daemonize no
is changed todaemonize yes
-
2. The default
protected-mode yes
is changed toprotected-mode no
-
3. Change the default bind 127.0.0.1 to directly comment out (the default bind 127.0.0.1 can only be accessed by the local machine) or change the local IP address, otherwise it will affect the remote IP connection
- 4. Add the redis password to requirepass to the password you set yourself
4. Start the service
/usr/local/bin
Run under the directory , redis-server
enable the files /myredis
under the directoryredis.conf
redis-server /myredis/redis7.conf
Note: there is no space in the middle of redis-server,2023年3月14日,在-后加了空格找半天
ps -ef|grep redis|grep -v grep
Use the above command to view the port
5. Connection service
redis-cli -a 1234 -p 6379
The password is the password in the modified configuration file above, the default port is 6379, and the warning warning is ignored, which
means that the Redis server can be used normally, try hellowrold
6. Close the service
SHUTDOWN
Just use the command directly under the Redis server- Single instance shutdown:
redis-cli -a 111111 shutdown
- Multiple instances are closed, and the specified port is closed:
redis-cli -p 6379 shutdown
7. Uninstall
- 1. Stop the redis-server service
- 2. Delete the redis-related files in the /usr/local/lib directory