Redis

[root@localhost Cluster]# tar -xzf redis-3.2.9.tar.gz

[root@localhost Cluster]# cd redis-3.2.9

[root@localhost src]# make

[root@localhost src]# vim redis.conf


#后台运行

daemonize yes


#配置远程访问

# bind 127.0.0.1

protected-mode no


[root@localhost redis-3.2.9]# cd src

[root@localhost src]# ./redis-server ../redis.conf

#启动时需要带上配置文件


#配置访问密码

requirepass 123qwe


[root@localhost src]# ./redis-cli

127.0.0.1:6379> get mykey

"Hello,World!"

127.0.0.1:6379>


C:\Downloads\Redis-x64-3.2.100>redis-cli.exe -h 192.168.1.244 -p 6379

192.168.1.244:6379> set mykey Hello,World!

OK

192.168.1.244:6379> get mykey

"Hello,World!"

192.168.1.244:6379> ping

PONG


127.0.0.1:6379> config get protected-mode

1) "protected-mode"

2) "no"

127.0.0.1:6379>

127.0.0.1:6379> config get *


127.0.0.1:6379> config set protected-mode yes

OK

127.0.0.1:6379> config get pro*

1) "protected-mode"

2) "yes"

127.0.0.1:6379>


redis-cli -h host -p port -a password

redis-cli -h 127.0.0.1 -p 6379 -a "mypass"

redis 127.0.0.1:6379> AUTH "password"

OK

redis 127.0.0.1:6379> PING

PONG

redis 127.0.0.1:6379> INFO


keys * #所有键

flushdb #删除当前数据库中的所有Key

flushall #删除所有数据库中的key

你可能感兴趣的:(Redis)