你可能没有tcl:
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
cd /usr/local/tcl8.6.1/unix/
sudo ./configure
sudo make
sudo make install
step1:下载
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
step2:解压
tar -zxvf redis-3.2.8.tar.gz
step3:复制,放到usr/local⽬录下
sudo mv ./redis-3.2.8 /usr/local/redis/
step4:进⼊redis⽬录
cd /usr/local/redis/
step5:生成
sudo make
step6:测试,这段运⾏时间会较⻓
sudo make test
step7:安装,将redis的命令安装到/usr/bin/⽬录
sudo make install
step8:安装完成后,我们进入目录/usr/bin中查看
cd /usr/bin
ls -all
查看
redis-server redis服务器
redis-cli redis命令行客户端
redis-benchmark redis性能测试工具
redis-check-aof AOF文件修复工具
redis-check-rdb RDB文件检索工具
step9:配置⽂件,移动到/etc/⽬录下
配置⽂件⽬录为/usr/local/redis/redis.conf
sudo cp /usr/local/redis/redis.conf /etc/redis/
查看
sudo vi /etc/redis/redis.conf
核心配置选项
绑定ip:如果需要远程访问,可将此⾏注释,或绑定⼀个真实ip
bind 127.0.0.1
端⼝,默认为6379
port 6379
是否以守护进程运⾏
如果以守护进程运⾏,则不会在命令⾏阻塞,类似于服务
如果以⾮守护进程运⾏,则当前终端被阻塞
设置为yes表示守护进程,设置为no表示⾮守护进程
推荐设置为yes
daemonize yes
数据⽂件
dbfilename dump.rdb
数据⽂件存储路径
dir /var/lib/redis
⽇志⽂件
logfile /var/log/redis/redis-server.log
数据库,默认有16个
database 16
当如果选用云服务器,远程登陆redis时,云服务器打开对应的redis端口,默认是6379,以阿里云服务为例子,可以快速创建安全组规则
在远程登录成功后可能出现这样的问题:
47.94.93.153:6379> KEYS
(error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
这是,你需要在服务器上登陆redis客户端输入命令:
127.0.0.1:6379> CONFIG SET protected-mode no
OK
127.0.0.1:6379>
关闭保护模式