Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation of redis database and matters needing attention

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report