|
1、下载redis源码包,并进行解压缩操作
https://download.redis.io/releases/- [root@Redis-Ubuntu-1804-p21:~]# wget https://download.redis.io/releases/redis-5.0.14.tar.gz
- --2023-04-13 21:21:40-- https://download.redis.io/releases/redis-5.0.14.tar.gz
- Resolving download.redis.io (download.redis.io)... 45.60.125.1
- Connecting to download.redis.io (download.redis.io)|45.60.125.1|:443... connected.
- HTTP request sent, awaiting response... 200 OK
- Length: 2000179 (1.9M) [application/octet-stream]
- Saving to: ‘redis-5.0.14.tar.gz’
- redis-5.0.14.tar.gz 100%[=================================================================>] 1.91M 3.35MB/s in 0.6s
- 2023-04-13 21:21:43 (3.35 MB/s) - ‘redis-5.0.14.tar.gz’ saved [2000179/2000179]
- [root@Redis-Ubuntu-1804-p21:~]# tar xf redis-5.0.14.tar.gz
- [root@Redis-Ubuntu-1804-p21:~]# ls
- disk.sh issue os.version redis-5.0.14 redis-5.0.14.tar.gz system_info.sh
复制代码
2、创建redis用户,创建redis目录结构并授权- [root@Redis-Ubuntu-1804-p21:~]# useradd redis -s /sbin/nologin
- [root@Redis-Ubuntu-1804-p21:~]# mkdir /app/redis/{etc,log,data,run} -p
- [root@Redis-Ubuntu-1804-p21:~]# chown redis.redis /app/redis/ -R
- [root@Redis-Ubuntu-1804-p21:~]# id redis
- uid=2006(redis) gid=2006(redis) groups=2006(redis)
- [root@Redis-Ubuntu-1804-p21:~]# ll /app/redis/
- total 24
- drwxr-xr-x 6 redis redis 4096 Apr 13 21:36 ./
- drwxr-xr-x 3 root root 4096 Apr 13 21:36 ../
- drwxr-xr-x 2 redis redis 4096 Apr 13 21:36 data/
- drwxr-xr-x 2 redis redis 4096 Apr 13 21:36 etc/
- drwxr-xr-x 2 redis redis 4096 Apr 13 21:36 log/
- drwxr-xr-x 2 redis redis 4096 Apr 13 21:36 run/
复制代码 3、准备编译环境,安装 build-essential (如已具备可忽略)
4、切换解压的到redis目录下,进行编译安装到目录 /app/redis- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]#
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# tree /app/redis
- /app/redis
- ├── bin
- │ ├── redis-benchmark
- │ ├── redis-check-aof
- │ ├── redis-check-rdb
- │ ├── redis-cli
- │ ├── redis-sentinel -> redis-server
- │ └── redis-server
- ├── data
- ├── etc
- ├── log
- └── run
复制代码 安装过程如出现下方报错提示,返回第3步重新安装编译环境,或安装 gcc
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# make PREFIX=/app/redis/ install
- cd src && make install
- make[1]: Entering directory '/root/redis-5.0.14/src'
- CC Makefile.dep
- rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
- (cd ../deps && make distclean)
- make[2]: Entering directory '/root/redis-5.0.14/deps'
- (cd hiredis && make clean) > /dev/null || true
- (cd linenoise && make clean) > /dev/null || true
- (cd lua && make clean) > /dev/null || true
- (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
- (rm -f .make-*)
- make[2]: Leaving directory '/root/redis-5.0.14/deps'
- (rm -f .make-*)
- echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
- echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
- echo OPT=-O2 >> .make-settings
- echo MALLOC=jemalloc >> .make-settings
- echo CFLAGS= >> .make-settings
- echo LDFLAGS= >> .make-settings
- echo REDIS_CFLAGS= >> .make-settings
- echo REDIS_LDFLAGS= >> .make-settings
- echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
- echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings
- (cd ../deps && make hiredis linenoise lua jemalloc)
- make[2]: Entering directory '/root/redis-5.0.14/deps'
- (cd hiredis && make clean) > /dev/null || true
- (cd linenoise && make clean) > /dev/null || true
- (cd lua && make clean) > /dev/null || true
- (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
- (rm -f .make-*)
- (echo "" > .make-cflags)
- (echo "" > .make-ldflags)
- MAKE hiredis
- cd hiredis && make static
- make[3]: Entering directory '/root/redis-5.0.14/deps/hiredis'
- gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
- make[3]: gcc: Command not found
- Makefile:156: recipe for target 'net.o' failed
- make[3]: *** [net.o] Error 127
- make[3]: Leaving directory '/root/redis-5.0.14/deps/hiredis'
- Makefile:45: recipe for target 'hiredis' failed
- make[2]: *** [hiredis] Error 2
- make[2]: Leaving directory '/root/redis-5.0.14/deps'
- Makefile:199: recipe for target 'persist-settings' failed
- make[1]: [persist-settings] Error 2 (ignored)
- CC adlist.o
- /bin/sh: 1: cc: not found
- Makefile:257: recipe for target 'adlist.o' failed
- make[1]: *** [adlist.o] Error 127
- make[1]: Leaving directory '/root/redis-5.0.14/src'
- Makefile:9: recipe for target 'install' failed
- make: *** [install] Error 2
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]#
复制代码
重新编译安装出现 zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory 报错,执行 make MALLOC=libc PREFIX=/app/redis/ install
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# make PREFIX=/app/redis/ install
- cd src && make install
- make[1]: Entering directory '/root/redis-5.0.14/src'
- CC adlist.o
- In file included from adlist.c:34:0:
- zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory
- #include <jemalloc/jemalloc.h>
- ^~~~~~~~~~~~~~~~~~~~~
- compilation terminated.
- Makefile:257: recipe for target 'adlist.o' failed
- make[1]: *** [adlist.o] Error 1
- make[1]: Leaving directory '/root/redis-5.0.14/src'
- Makefile:9: recipe for target 'install' failed
- make: *** [install] Error 2
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# make MALLOC=libc PREFIX=/app/redis/ install
复制代码
5、创建命令软连接- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# tree /app/redis
- /app/redis
- ├── bin
- │ ├── redis-benchmark
- │ ├── redis-check-aof
- │ ├── redis-check-rdb
- │ ├── redis-cli
- │ ├── redis-sentinel -> redis-server
- │ └── redis-server
- ├── data
- ├── etc
- ├── log
- └── run
- 5 directories, 6 files
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# ln -s /app/redis/bin/* /usr/bin/
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# which red
- red redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
复制代码 6、复制并准备Redis配置文件- ##方法1:手动修改
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# cp redis.conf /app/redis/etc/redis_bak.conf
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# cd /app/redis/etc/
- [root@Redis-Ubuntu-1804-p21:etc]# ll
- total 72
- drwxr-xr-x 2 redis redis 4096 Apr 13 22:36 ./
- drwxr-xr-x 7 redis redis 4096 Apr 13 22:21 ../
- -rw-r--r-- 1 root root 63088 Apr 13 22:36 redis_bak.conf
- [root@Redis-Ubuntu-1804-p21:etc]# vim redis_bak.conf
- bind 0.0.0.0
- port 6379
- pidfile /app/redis/run/redis_6379.pid
- logfile "redis_6379.log"
- always-show-logo no
- dbfilename dump_6379.rdb
- dir /app/redis/data
- appendfilename "appendonly_6379.aof"
- [root@Redis-Ubuntu-1804-p21:etc]# cat redis_bak.conf | grep ^[A-z] > redis_6379.confcat redis_bak.conf | grep ^[A-z] > redis_6379.conf
- [root@Redis-Ubuntu-1804-p21:etc]# sed 's/6379/6380/g' redis_6379.conf > redis_6380.conf
- [root@Redis-Ubuntu-1804-p21:etc]# sed 's/6379/6381/g' redis_6379.conf > redis_6381.conf
- [root@Redis-Ubuntu-1804-p21:etc]# chown redis.redis /app/redis/ -R
- [root@Redis-Ubuntu-1804-p21:etc]# ll
- total 84
- drwxr-xr-x 2 redis redis 4096 Apr 13 22:52 ./
- drwxr-xr-x 7 redis redis 4096 Apr 13 22:21 ../
- -rw-r--r-- 1 redis redis 1452 Apr 13 22:51 redis_6379.conf
- -rw-r--r-- 1 redis redis 1452 Apr 13 22:52 redis_6380.conf
- -rw-r--r-- 1 redis redis 1452 Apr 13 22:52 redis_6381.conf
- -rw-r--r-- 1 redis redis 63115 Apr 13 22:47 redis_bak.conf
- [root@Redis-Ubuntu-1804-p21:etc]#
复制代码 - ##方法2 sed修改并写入新配置文件
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# sed -e 's/^bind 127.0.0.1/bind 0.0.0.0/g' -e 's/^pidfile \/var\/run\/redis_6379.pid/pidfile \/app\/redis\/run\/redis_6379.pid/g' -e 's/^logfile ""/logfile "\/app\/redis\/log\/redis_6379.log"/g' -e 's/^always-show-logo yes/always-show-logo no/g' -e 's/^appendfilename "appendonly.aof"/appendfilename "appendonly_6379.aof"/g' -e 's/^dbfilename dump.rdb/dbfilename dump_6379.rdb/g' -e 's/^dir \.\//dir \/app\/redis\/data/g' redis.conf > /app/redis/etc/redis_6379.conf
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# sed 's/6379/6380/g' /app/redis/etc/redis_6379.conf > /app/redis/etc/redis_6380.conf
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# sed 's/6379/6381/g' /app/redis/etc/redis_6379.conf > /app/redis/etc/redis_6381.conf
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# chown redis.redis /app/redis/ -R
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]# ll /app/redis/etc
- total 200
- drwxr-xr-x 2 redis redis 4096 Apr 13 23:46 ./
- drwxr-xr-x 7 redis redis 4096 Apr 13 22:21 ../
- -rw-r--r-- 1 redis redis 63128 Apr 13 23:34 redis_6379.conf
- -rw-r--r-- 1 redis redis 63128 Apr 13 23:47 redis_6380.conf
- -rw-r--r-- 1 redis redis 63128 Apr 13 23:47 redis_6381.conf
- [root@Redis-Ubuntu-1804-p21:redis-5.0.14]#
复制代码
7、redis service服务配置- [root@Redis-Ubuntu-1804-p21:~]# vim /etc/systemd/system/redis_6379.service
- [Unit]
- Description=Redis persistent key-value database
- After=network.target
- [Service]
- ExecStart=/app/redis/bin/redis-server /app/redis/etc/redis_6379.conf --supervised systemd
- ExecStop=/bin/kill -s QUIT
- Type=notify
- User=redis
- Group=redis
- RuntimeDirectory=redis
- RuntimeDirectoryMode=0755
- LimitNOFILE=65536
- [Install]
- WantedBy=multi-user.target<br>
- [root@Redis-Ubuntu-1804-p21:~]# sed 's/6379/6380/g' /etc/systemd/system/redis_6379.service > /etc/systemd/system/redis_6380.service
- [root@Redis-Ubuntu-1804-p21:~]# sed 's/6379/6381/g' /etc/systemd/system/redis_6379.service > /etc/systemd/system/redis_6381.service
- [root@Redis-Ubuntu-1804-p21:~]# systemctl daemon-reload<br>
复制代码
8、启动服务并设置开机自启动
- [root@Redis-Ubuntu-1804-p21:~]# systemctl enable --now redis_6379.service redis_6380.service redis_6381.service
- Created symlink /etc/systemd/system/multi-user.target.wants/redis_6379.service → /etc/systemd/system/redis_6379.service.
- Created symlink /etc/systemd/system/multi-user.target.wants/redis_6380.service → /etc/systemd/system/redis_6380.service.
- Created symlink /etc/systemd/system/multi-user.target.wants/redis_6381.service → /etc/systemd/system/redis_6381.service.
- [root@Redis-Ubuntu-1804-p21:~]# ps -ef | grep redis-server
- redis 10491 1 0 00:24 ? 00:00:00 /app/redis/bin/redis-server 0.0.0.0:6381
- redis 10492 1 0 00:24 ? 00:00:00 /app/redis/bin/redis-server 0.0.0.0:6380
- redis 10493 1 0 00:24 ? 00:00:00 /app/redis/bin/redis-server 0.0.0.0:6379
- root 10512 1247 0 00:25 pts/0 00:00:00 grep --color=auto redis-server
- [root@Redis-Ubuntu-1804-p21:~]# ss -ntl
- State Recv-Q Send-Q Local Address:Port Peer Address:Port
- LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:*
- LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
- LISTEN 0 128 127.0.0.1:6010 0.0.0.0:*
- LISTEN 0 128 127.0.0.1:6011 0.0.0.0:*
- LISTEN 0 128 0.0.0.0:6379 0.0.0.0:*
- LISTEN 0 128 0.0.0.0:6380 0.0.0.0:*
- LISTEN 0 128 0.0.0.0:6381 0.0.0.0:*
- LISTEN 0 128 [::]:22 [::]:*
- LISTEN 0 128 [::1]:6010 [::]:*
- LISTEN 0 128 [::1]:6011 [::]:*
- [root@Redis-Ubuntu-1804-p21:~]#
复制代码 [root@Redis-Ubuntu-1804-p21:~]# tree /app/redis
/app/redis
├── bin
│ ├── redis-benchmark
│ ├── redis-check-aof
│ ├── redis-check-rdb
│ ├── redis-cli
│ ├── redis-sentinel -> redis-server
│ └── redis-server
├── data
│ └── dump_6379.rdb
├── etc
│ ├── redis_6379.conf
│ ├── redis_6380.conf
│ └── redis_6381.conf
├── log
│ ├── redis_6379.log
│ ├── redis_6380.log
│ └── redis_6381.log
└── run
├── redis_6379.pid
├── redis_6380.pid
└── redis_6381.pid
5 directories, 16 files
[root@Redis-Ubuntu-1804-p21:~]#
9、观察启动日志,优化系统环境配置
- 10492:C 14 Apr 2023 00:24:57.118 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
- 10492:C 14 Apr 2023 00:24:57.118 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=10492, just started
- 10492:C 14 Apr 2023 00:24:57.118 # Configuration loaded
- 10492:C 14 Apr 2023 00:24:57.118 * supervised by systemd, will signal readiness
- 10492:M 14 Apr 2023 00:24:57.127 * Running mode=standalone, port=6380.
- 10492:M 14 Apr 2023 00:24:57.127 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
- 10492:M 14 Apr 2023 00:24:57.127 # Server initialized
- 10492:M 14 Apr 2023 00:24:57.127 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
- 10492:M 14 Apr 2023 00:24:57.127 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
- 10492:M 14 Apr 2023 00:24:57.132 * Ready to accept connections
复制代码 - [root@Redis-Ubuntu-1804-p21:~]# cat /proc/sys/net/core/somaxconn
- 128
- [root@Redis-Ubuntu-1804-p21:~]# cat /proc/sys/vm/overcommit_memory
- 0
- ## 补充2个参赛
- [root@Redis-Ubuntu-1804-p21:~]# vim /etc/sysctl.conf
- net.core.somaxconn=1024
- vm.overcommit_memory=1
- [root@Redis-Ubuntu-1804-p21:~]# tail /etc/sysctl.conf
- # Protected links
- #
- # Protects against creating or following links under certain conditions
- # Debian kernels have both set to 1 (restricted)
- # See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
- #fs.protected_hardlinks=0
- #fs.protected_symlinks=0
- net.core.somaxconn=1024
- vm.overcommit_memory=1
- [root@Redis-Ubuntu-1804-p21:~]# sysctl -p
- net.core.somaxconn = 1024
- vm.overcommit_memory = 1
- [root@Redis-Ubuntu-1804-p21:~]# cat /proc/sys/net/core/somaxconn
- 1024
- [root@Redis-Ubuntu-1804-p21:~]# cat /proc/sys/vm/overcommit_memory
- 1
- <br>
复制代码 禁用透明大页- #临时修改
- [root@Redis-Ubuntu-1804-p21:~]# cat /sys/kernel/mm/transparent_hugepage/enabled
- always [madvise] never
- [root@Redis-Ubuntu-1804-p21:~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
- [root@Redis-Ubuntu-1804-p21:~]# cat /sys/kernel/mm/transparent_hugepage/enabled
- always madvise [never]
- #永久修改生效 在开机启动过程中禁用
- [root@Redis-Ubuntu-1804-p21:~]# cat > /etc/init.d/disable_transparent_hugepage << EOF
- > !/bin/bash
- > echo never > /sys/kernel/mm/transparent_hugepage/enabled
- > EOF
- [root@Redis-Ubuntu-1804-p21:~]# chmod 755 /etc/init.d/disable_transparent_hugepage
- [root@Redis-Ubuntu-1804-p21:~]# cd /etc/rcS.d/
- [root@Redis-Ubuntu-1804-p21:rcS.d]# ln -s ../init.d/disable_transparent_hugepage disable_transparent_hugepage
- [root@Redis-Ubuntu-1804-p21:rcS.d]# ll /etc/init.d/ | grep disable_trans
- -rwxr-xr-x 1 root root 68 Apr 14 00:44 disable_transparent_hugepage*
- [root@Redis-Ubuntu-1804-p21:rcS.d]# ll | grep disable
- lrwxrwxrwx 1 root root 38 Apr 14 00:45 disable_transparent_hugepage -> ../init.d/disable_transparent_hugepage*
复制代码
10、重启Redis服务、重启服务器验证
- [root@Redis-Ubuntu-1804-p21:~]# systemctl restart redis_6380.service
- [root@Redis-Ubuntu-1804-p21:~]# tail -f /app/redis/log/redis_6380.log
- 0492:M 14 Apr 2023 00:24:57.127 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
- 10492:M 14 Apr 2023 00:24:57.132 * Ready to accept connections
- 10492:signal-handler (1681404602) Received SIGTERM scheduling shutdown...
- 10492:M 14 Apr 2023 00:50:02.103 # User requested shutdown...
- 10492:M 14 Apr 2023 00:50:02.103 * Saving the final RDB snapshot before exiting.
- 10492:M 14 Apr 2023 00:50:02.113 * DB saved on disk
- 10492:M 14 Apr 2023 00:50:02.113 * Removing the pid file.
- 10492:M 14 Apr 2023 00:50:02.113 # Redis is now ready to exit, bye bye...
- 10710:C 14 Apr 2023 00:50:02.131 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
- 10710:C 14 Apr 2023 00:50:02.131 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=10710, just started
- 10710:C 14 Apr 2023 00:50:02.132 # Configuration loaded
- 10710:C 14 Apr 2023 00:50:02.132 * supervised by systemd, will signal readiness
- 10710:M 14 Apr 2023 00:50:02.137 * Running mode=standalone, port=6380.
- 10710:M 14 Apr 2023 00:50:02.137 # Server initialized
- 10710:M 14 Apr 2023 00:50:02.137 * DB loaded from disk: 0.000 seconds
- 10710:M 14 Apr 2023 00:50:02.138 * Ready to accept connections
复制代码 - [root@Redis-Ubuntu-1804-p21:~]# reboot
- --------------------
- [root@Redis-Ubuntu-1804-p21:~]# ps -ef | grep redis-server
- redis 858 1 0 00:52 ? 00:00:00 /app/redis/bin/redis-server 0.0.0.0:6380
- redis 926 1 0 00:52 ? 00:00:00 /app/redis/bin/redis-server 0.0.0.0:6381
- redis 928 1 0 00:52 ? 00:00:00 /app/redis/bin/redis-server 0.0.0.0:6379
- root 1419 1403 0 00:53 pts/0 00:00:00 grep --color=auto redis-server
- [root@Redis-Ubuntu-1804-p21:~]# ss -ntl
- State Recv-Q Send-Q Local Address:Port Peer Address:Port
- LISTEN 0 511 0.0.0.0:6379 0.0.0.0:*
- LISTEN 0 511 0.0.0.0:6380 0.0.0.0:*
- LISTEN 0 511 0.0.0.0:6381 0.0.0.0:*
- LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:*
- LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
- LISTEN 0 128 127.0.0.1:6010 0.0.0.0:*
- LISTEN 0 128 127.0.0.1:6011 0.0.0.0:*
- LISTEN 0 128 [::]:22 [::]:*
- LISTEN 0 128 [::1]:6010 [::]:*
- LISTEN 0 128 [::1]:6011 [::]:*
- [root@Redis-Ubuntu-1804-p21:~]# tail -f /app/redis/log/redis_6380.log
- 10710:M 14 Apr 2023 00:52:27.248 # Redis is now ready to exit, bye bye...
- 858:C 14 Apr 2023 00:52:41.166 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
- 858:C 14 Apr 2023 00:52:41.166 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=858, just started
- 858:C 14 Apr 2023 00:52:41.166 # Configuration loaded
- 858:C 14 Apr 2023 00:52:41.166 * supervised by systemd, will signal readiness
- 858:M 14 Apr 2023 00:52:41.170 * Running mode=standalone, port=6380.
- 858:M 14 Apr 2023 00:52:41.170 # Server initialized
- 858:M 14 Apr 2023 00:52:41.170 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
- 858:M 14 Apr 2023 00:52:41.171 * DB loaded from disk: 0.001 seconds
- 858:M 14 Apr 2023 00:52:41.171 * Ready to accept connections
复制代码
11、连接数据库,验证数据读写- [root@Redis-Ubuntu-1804-p21:~]# redis-cli set name janzen
- OK
- [root@Redis-Ubuntu-1804-p21:~]# redis-cli get name
- "janzen"
- [root@Redis-Ubuntu-1804-p21:~]# redis-cli -p 6380 set name janzen80
- OK
- [root@Redis-Ubuntu-1804-p21:~]# redis-cli -p 6380 get name
- "janzen80"
- [root@Redis-Ubuntu-1804-p21:~]# redis-cli -p 6381 set name janzen81
- OK
- [root@Redis-Ubuntu-1804-p21:~]# redis-cli -p 6381 get name
- "janzen81"
- [root@Redis-Ubuntu-1804-p21:~]#
复制代码
来源:https://www.cnblogs.com/Janzen-q/p/17314922.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作! |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|