当前位置:网站首页>Redis installation of CentOS system under Linux, adding, querying, deleting, and querying all keys

Redis installation of CentOS system under Linux, adding, querying, deleting, and querying all keys

2022-06-24 19:51:00 just_ peanut

background : Study Redis Basic operation
System :CentOS Linux release 8.2.2004 (Core)
 Insert picture description here
Operation steps :
1、 install C Language compiling environment , because Redis yes C Language development , command :yum -y install gcc-c++
2、 Connect Linux, I am using Alibaba cloud , Execute the following statement to obtain the installation package

cd home/
wget http://download.redis.io/releases/redis-6.0.9.tar.gz

3、 decompression

 tar -zxvf redis-6.0.9.tar.gz

4、 Enter the unzipped file , And compile

cd redis-6.0.9/
make

5、 install , And copy redis.conf To install directory

make PREFIX=/usr/local/redis install
cp redis.conf /usr/local/redis/

6、 modify redis.con in daemonize The parameters for yes, And save exit

 Insert picture description here
7、 start-up redis, Background start , Exit connected xshell client , It will also work properly

cd /usr/local/redis/
./bin/redis-server ./redis.conf

8、 see redis Startup successful

ps -ef | grep redis

 Insert picture description here

9、 stop it redis

./bin/redis-cli shutdown

10、 increase , Inquire about , Delete data , In this directory :/usr/local/redis/bin

[[email protected] bin]# ./redis-cli
127.0.0.1:6379> set test hello
OK
127.0.0.1:6379> get test
"hello"
127.0.0.1:6379> del test
(integer) 1
127.0.0.1:6379> get test
(nil)
127.0.0.1:6379>

11、 Query all key

127.0.0.1:6379> set test hello
OK
127.0.0.1:6379> set test1 hello1
OK
127.0.0.1:6379> set test2 hello2
OK
127.0.0.1:6379> keys *
1) "test"
2) "test1"
3) "test2"
原网站

版权声明
本文为[just_ peanut]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211328052014.html