Overview
Every time you install, you will always forget some commands or encounter problems. Considering that every time you search and see articles that are not so reliable, a lot of time is wasted, so this article is just a record and continuous update.
single vision
Linux
Note: The Linux version of this article is CentOS 8.
First go to the Redis official website to download the compressed package, such as redis-5.0.9.tar.gz
, and then upload it to the root
user's default directory:, /root
unzip to the /usr/local
directory:
tar zxvf redis-5.0.9.tar.gz -C /usr/local
directory rename:
mv redis-5.0.9/ redis
enter the redis
directory:
cd redis
execute make
, then execute make install
, so far the installation is successful.
pwd
View the current directory, output:
/usr/local/redis
ll
view all files, output:
total 284
-rw-rw-r--. 1 root root 119270 Apr 17 2020 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 Apr 17 2020 BUGS
-rw-rw-r--. 1 root root 2381 Apr 17 2020 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 Apr 17 2020 COPYING
drwxrwxr-x. 6 root root 192 Feb 19 01:50 deps
-rw-r--r--. 1 root root 92 Feb 19 02:58 dump.rdb
-rw-rw-r--. 1 root root 11 Apr 17 2020 INSTALL
-rw-rw-r--. 1 root root 151 Apr 17 2020 Makefile
-rw-rw-r--. 1 root root 6888 Apr 17 2020 MANIFESTO
-rw-rw-r--. 1 root root 20555 Apr 17 2020 README.md
-rw-rw-r--. 1 root root 61819 Feb 19 03:12 redis.conf
-rwxrwxr-x. 1 root root 275 Apr 17 2020 runtest
-rwxrwxr-x. 1 root root 280 Apr 17 2020 runtest-cluster
-rwxrwxr-x. 1 root root 373 Apr 17 2020 runtest-moduleapi
-rwxrwxr-x. 1 root root 281 Apr 17 2020 runtest-sentinel
-rw-rw-r--. 1 root root 9710 Apr 17 2020 sentinel.conf
drwxrwxr-x. 3 root root 8192 Feb 19 01:51 src
drwxrwxr-x. 11 root root 182 Apr 17 2020 tests
drwxrwxr-x. 8 root root 4096 Apr 17 2020 utils
Start Redis:
/usr/local/redis/src/redis-server /usr/local/redis/redis.conf
see the familiar console output:
36705:C 19 Feb 2021 02:57:50.909 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
36705:C 19 Feb 2021 02:57:50.909 # Redis version=5.0.9, bits=64, commit=00000000, modified=0, pid=36705, just started
36705:M 19 Feb 2021 02:57:50.910 * Increased maximum number of open files to 10032 (it was originally set to 1024).
36705:M 19 Feb 2021 02:57:50.910 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
36705:M 19 Feb 2021 02:57:50.910 # Server initialized
36705:M 19 Feb 2021 02:57:50.910 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
36705:M 19 Feb 2021 02:57:50.911 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
36705:M 19 Feb 2021 02:57:50.911 * Ready to accept connections
But this way is to start in the foreground, modify the configuration file:
vim /usr/local/redis/redis.conf
find it daemonize
, set it to the daemonize yes
command is too long and inconvenient, create a soft link:
ln -s /usr/local/redis/src/redis-server /usr/bin/redis-server
start:
redis-server /usr/local/redis/redis.conf
problem
If the make
final output
Hint: It's a good idea to run 'make test' ;)
is executed : Generally, the installation is not completely successful, execute the command:
make test
Install the corresponding package according to the error message.
Problems encountered:
make test
TheYou need tcl 8.5 or newer in order to run the Redis test
solution is to download and installtcl
:wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz tar xzvf tcl8.6.1-src.tar.gz cd tcl8.6.1/unix/ ./configure make make install
make test
Error: TheI/O error reading reply while executing
solution is to install tcl.
Client connection
Now that it has been successfully installed and started, how to connect through a client such as RedisPlus.
Modify the configuration file:
vim /usr/local/redis/redis.conf
update the configuration:
protected-mode no
just modify the above configuration is not enough.
Also need to be modified bind 127.0.0.1
to bind 192.168.20.149
.
Of course, this way is to configure no password.
Windows
Register as a local service:
./redis-server.exe --service-install redis.windows.conf --service-name redis --port 6379
Open the task manager-service list, you can see the Redis service, right-click to open the service , open the service manager, right-click the properties, you can set the startup type, the default is automatic:
after a period of use, the Redis service is found stopped :
can not start, the error message when the service manager starts to 本地计算机上的Redis服务启动后停止
uninstall reinstall:
./redis-server.exe --service-uninstall redis.windows.conf --service-name redis --port 6379
the need to install additional parameters --maxmemory 200m
, namely the complete command is:
./redis-server.exe --service-install redis.windows.conf --service-name redis --port 6379 --maxmemory 200m