[root@redis ~]# cd redis-stable/ [root@redis redis-stable]# make //最后出现这个就表示成功了 Hint: It's a good idea to run 'make test' ;) make[1]: Leaving directory '/root/redis-stable/src' [root@redis redis-stable]# make install //出现这些是表示安装好了,不是报错 cd src && make install make[1]: Entering directory '/root/redis-stable/src' Hint: It's a good idea to run 'make test' ;)
[root@redis redis]# redis-server redis.conf 6115:C 08 Aug 202410:26:14.494 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 6115:C 08 Aug 202410:26:14.494 * Redis version=7.4.0, bits=64, commit=00000000, modified=0, pid=6115, just started 6115:C 08 Aug 202410:26:14.495 * Configuration loaded 6115:M 08 Aug 202410:26:14.495 * Increased maximum number of open files to 10032 (it was originally set to 1024). 6115:M 08 Aug 202410:26:14.495 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis Community Edition .-`` .-```. ```\/ _.,_ ''-._ 7.4.0 (00000000/0) 64 bit ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 6115 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'
6115:M 08 Aug 202410:26:14.498 * Server initialized 6115:M 08 Aug 202410:26:14.498 * Ready to accept connections tcp
此时你会发现前端运行的话当前窗口就不能再使用了需要再开一个窗口,不那么方便
后台运行
1 2 3 4 5 6 7 8 9 10 11
首先Ctrl+c停止运行,然后修改redis配置文件
[root@redis redis]# vim redis.conf ################################# GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it. # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. # When Redis is supervised by upstart or systemd, this parameter has no impact. daemonize yes //找到这一行将no改为yes
# The requirepass is not compatible with aclfile option and the ACL LOAD # command, these will cause requirepass to be ignored. # requirepass foobared //将这一行的#删除 //验证密码就是foobared,这是默认密码
[root@redis redis]# redis-cli 127.0.0.1:6379> auth foobared //验证密码 OK 127.0.0.1:6379> set name tom //设置名字 OK 127.0.0.1:6379> get name "tom" 127.0.0.1:6379> quit
# Accept connections on the specified port, default is 6379 (IANA #815344). # If port 0 is specified Redis will not listen on a TCP socket. port 6380 //搜索port找到这一行,将端口修改为6380 # TCP listen() backlog.
[root@redis redis]# redis-cli -h 127.0.0.1 -p 6379 127.0.0.1:6379> auth foobared OK 127.0.0.1:6379> set age 19 OK 127.0.0.1:6379> get age "19" 127.0.0.1:6379> inforeplication
[root@redis ~]# cd redis-stable/ [root@redis redis-stable]# ls 00-RELEASENOTES CONTRIBUTING.md LICENSE.txt README.md runtest runtest-sentinel src utils BUGS deps Makefile redis.conf runtest-cluster SECURITY.md tests CODE_OF_CONDUCT.md INSTALL MANIFESTO REDISCONTRIBUTIONS.txt runtest-moduleapi sentinel.conf TLS.md [root@redis redis-stable]# cp sentinel.conf /etc/redis/ [root@redis redis-stable]# cd /etc/redis/ [root@redis redis]# ls 6379.conf 6380.conf dump.rdb sentinel.conf [root@redis redis]# vim sentinel.conf //修改文件内容 # By default Redis Sentinel does not run as a daemon. Use 'yes' if you need it. # Note that Redis will write a pid file in /var/run/redis-sentinel.pid when # daemonized. daemonize yes //找到这里修改为yes,允许后台运行
# Note: master name should not include special characters or spaces. # The valid charset is A-z 0-9 and the three characters ".-_". sentinel monitor mymaster 127.0.0.163791 //搜索找到这一行,将2改为1