Get the App
SLTechnology News&Howtos  ›  Database  › 

Installation of redis database and matters needing attention

Shulou Source: shulou.com Published: 2022-06-01 09:31:39 09月11日 Update

Install the source package

[root@40] # tar-xf redis/redis-4.0.8.tar.gz-C.

[root@40 ~] # cd redis-4.0.8/

[root@40 redis-4.0.8] # yum-y install gcc gcc-c++

[root@40 redis-4.0.8] # make & & make install

[root@40 redis-4.0.8] #. / utils/install_server.sh

[root@40 redis-4.0.8] # vim / etc/redis/6379.conf

70 bind 192.168.4.40 # modify ip

93 port 6040 # modify Port

[root@40 redis-4.0.8] # ln-s / etc/init.d/redis_6379 / sbin/

[root@40 redis-4.0.8] # redis_6379 stop

[root@40 redis-4.0.8] # redis_6379 start

[root@40 ~] # ss-antulp | grep redis

Tcp LISTEN 0 128 192.168.4.40 pid=4846,fd=6 6040: users: ("redis-server", pid=4846,fd=6)

Closing redis with a script at this time will report the following error

[root@40 ~] # redis_6379-stop

Please use start, stop, restart or status as first argument

Solution 1: [root@40 ~] # redis-cli-h 192.168.4.40-p 6040 shutdown

Solution 2: you need to change the script file

[root@40 ~] # vim / etc/init.d/redis_6379

8 REDISPORT= "6040"

43$ CLIEXEC-h 192.168.4.40-p $REDISPORT shutdown

After setting it up, you can use footsteps to turn it off.

Such as:

[root@40 ~] # ss-antulp | grep redis

Tcp LISTEN 0 128 192.168.4.40 pid=4846,fd=6 6040: users: ("redis-server", pid=4846,fd=6)

Close redis

[root@40 ~] # redis_6379 stop

Stopping...

Redis stopped

Set the connection password

1. Modify the configuration file

[root@40 ~] # vim / etc/redis/6379.conf

501 requirepass 123446 (password)

After setting the secret, the following error occurs when we close the file with a script

[root@40 ~] # redis_6379 stop

Stopping...

(error) NOAUTH Authentication required.

Waiting for Redis to shutdown...

Waiting for Redis to shutdown...

Waiting for Redis to shutdown...

Waiting for Redis to shutdown...

Waiting for Redis to shutdown...

.

Solution 1:

[root@40] # redis-cli-h 192.168.4.40-p 6040-a 123446 shutdown

Solution 2: modify the script file

43$ CLIEXEC-h 192.168.4.40-p $REDISPORT-a 123446 shutdown

[root@40 ~] # redis_6379 stop

Stopping...

Waiting for Redis to shutdown...

Redis stopped

Tags: Files methods scripts passwords source code secrets ports footsteps errors reports configurations events data databases precautions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Information Huawei Linux vpn