解压 tar zxvf redis-5.0.8.tar.gz
创建目录 mkdir /usr/local/java/redis
拷贝配置文件 cp redis.conf /usr/local/java/redis
服务端启动 ./bin/redis-server
客户端使用
[root@bogon package]# cd /usr/local/java/redis
[root@bogon redis]# ./bin/redis-cli -a 123456
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> set a1 12
OK
127.0.0.1:6379> get a1
"12"
127.0.0.1:6379>
redis.conf配置
# 关闭保护模式,用于公网访问
protected-mode no
port 6379
# 后台启动
daemonize yes
pidfile /var/run/redis_6379.pid
logfile "6379.log"
# dir ./
# bind 127.0.0.1
# 设置redis密码,各节点保持一致
requirepass 123456