网络公司排名图/500强企业seo服务商

网络公司排名图,500强企业seo服务商,光明新区住房和建设局网站,孔家庄网站建设编译安装redis,systemtcl配置redis自启动,系统并发调优 1、编译安装redis wget https://download.redis.io/releases/redis-7.4.2.tar.gz tar -zxf redis-7.4.2.tar.gz cd redis-7.4.2/ make make install/usr/local/bin/redis-server -v2、systemtcl配…

编译安装redis,systemtcl配置redis自启动,系统并发调优

1、编译安装redis

wget https://download.redis.io/releases/redis-7.4.2.tar.gz
tar -zxf redis-7.4.2.tar.gz
cd redis-7.4.2/
make
make install/usr/local/bin/redis-server -v

2、systemtcl配置redis自启动

[Unit]
Description=Redis In-Memory Data Store
After=network.target[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli -a 1234qwer shutdown
Restart=always
Type=simple[Install]
WantedBy=multi-user.target

注意:

(1)如果在命令行里复制粘贴,可能会丢失前四个字母。

可通过systemd-analyze verify /etc/systemd/system/redis.service验证语法是否正确

[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl enable redis
Failed to execute operation: Bad message
# 检验/etc/systemd/system/redis.service文件格式
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemd-analyze verify /etc/systemd/system/redis.service
[/etc/systemd/system/redis.service:1] Assignment outside of section. Ignoring.
[/etc/systemd/system/redis.service:2] Assignment outside of section. Ignoring.
[/etc/systemd/system/redis.service:3] Assignment outside of section. Ignoring.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemd-analyze verify /etc/systemd/system/redis.service
[root@iZ8vb45ie77v5ybgcemxysZ ~]#

(2)如果redis配置了密码,停止命令要加上redis-cli -a <密码> [操作参数]

# 无密码关闭
ExecStop=/usr/local/bin/redis-cli shutdown
# 有密码关闭
ExecStop=/usr/local/bin/redis-cli -a 1234qwer shutdown

3、权限不足导致redis无法重启的问题

配置完redis.service还没有完,redis会操作三个系统文件或目录:

/var/run/redis_6379.pid 存放当前redis进程的进程号,配置:pidfile /var/run/redis_6379.pid

/var/lib/redis/(目录) 存放redis持久化数据库,配置:dir /var/lib/redis

/var/log/redis/redis.log 存放redis运行日志,配置:logfile /var/log/redis/redis.log

需要将/var/run/redis_6379.pid/、/var/lib/redis/目录和/var/log/redis/目录赋予redis用户操作权限

(1)解决redis_6379.pid文件写权限问题
# 根据打印Failed to write PID file: Permission denied[root@iZ8vb45ie77v5ybgcemxysZ ~]# touch /var/run/redis_6379.pid
[root@iZ8vb45ie77v5ybgcemxysZ ~]# chown redis:redis /var/run/redis_6379.pid# 
# #logfile ""
logfile /var/log/redis/redis.log
(2)解决log文件缺失问题
# 根据提示(error) ERR Errors trying to SHUTDOWN. Check logs.
# 先设置log目录权限
chown redis:redis /var/log/redis

修改/etc/redis/redis.conf配置项

# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
#logfile ""logfile /var/log/redis/redis.log
(3)解决db文件写权限问题
# 根据redis.log中的报错
9518:M 20 Mar 2025 12:16:54.936 # Failed opening the temp RDB file temp-9518.rdb (in server root dir /) for saving: Permission denied
9518:M 20 Mar 2025 12:16:54.936 # Error trying to save the DB, can't exit.
9518:M 20 Mar 2025 12:16:54.936 # Errors trying to shut down the server. Check the logs for more information.# 创建相应路径并赋予权限
chown redis:redis /var/lib/redis

修改/etc/redis/redis.conf配置项

# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
#dir ./dir /var/lib/redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis      898     1  0 11:34 ?        00:00:03 /usr/local/bin/redis-server 0.0.0.0:6379
root      1502  1416  0 11:54 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status reids
Unit reids.service could not be found.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2025-03-20 11:34:43 CST; 19min agoMain PID: 898 (redis-server)CGroup: /system.slice/redis.service└─898 /usr/local/bin/redis-server 0.0.0.0:6379Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:C 20 Mar 2025 11:34:43.508 * Configuration loaded
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 # You requested maxclients of 10000 requi...ptors.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 # Server can't set maximum open files to ...itted.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 # Current maximum open files is 4096. max...t -n'.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 * monotonic clock: POSIX clock_gettime
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.511 # Failed to write PID file: Permission denied
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.511 * Running mode=standalone, port=6379.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.511 # WARNING: The TCP backlog setting of 511...f 128.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.514 * Server initialized
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.517 * Ready to accept connections tcp
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# touch /var/run/redis_6379.pid
[root@iZ8vb45ie77v5ybgcemxysZ ~]# chown redis:redis /var/run/redis_6379                                                                     .pid
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2025-03-20 12:05:30 CST; 1min 12s agoProcess: 5032 ExecStop=/usr/local/bin/redis-cli shutdown (code=exited, status=0/SUCCESS)Main PID: 5575 (redis-server)CGroup: /system.slice/redis.service└─5575 /usr/local/bin/redis-server 0.0.0.0:6379Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:C 20 Mar 2025 12:05:30.760 * Redis version=7.4.2, bits=64, commit=0...arted
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:C 20 Mar 2025 12:05:30.760 * Configuration loaded
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 # You requested maxclients of 10000 requ...tors.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 # Server can't set maximum open files to...tted.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 # Current maximum open files is 4096. ma... -n'.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 * monotonic clock: POSIX clock_gettime
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 * Running mode=standalone, port=6379.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 # WARNING: The TCP backlog setting of 51... 128.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 * Server initialized
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 * Ready to accept connections tcp
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis     5575     1  0 12:05 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root      6189  1416  0 12:07 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /var/run/redis_6379.pid
5575
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli shutdown
(error) NOAUTH Authentication required.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  shutdown
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
(error) ERR Errors trying to SHUTDOWN. Check logs.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  ping
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
PONG
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli
127.0.0.1:6379> auth
(error) ERR wrong number of arguments for 'auth' command
127.0.0.1:6379> auth 1234qwer
OK
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> SHUTDOWN
(error) ERR Errors trying to SHUTDOWN. Check logs.
127.0.0.1:6379> kill -9 5575
(error) ERR unknown command 'kill', with args beginning with: '-9' '5575'
127.0.0.1:6379> quit
[root@iZ8vb45ie77v5ybgcemxysZ ~]# kill -9 5575
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis     9518     1  0 12:16 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root      9549  1416  0 12:16 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /var/run/redis_6379.pid
9518
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer shutdown
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
(error) ERR Errors trying to SHUTDOWN. Check logs.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# kill -9 9518
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    11057     1  0 12:20 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     11094  1416  0 12:20 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /var/run/redis_6379.pid
11057
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli shutdown
(error) NOAUTH Authentication required.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  shutdown
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    11240     1  0 12:20 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     11289  1416  0 12:21 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl daemon-reload
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl stop redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: inactive (dead) since Thu 2025-03-20 12:23:14 CST; 5s agoProcess: 12130 ExecStop=/usr/local/bin/redis-cli -a 1234qwer  shutdown (code=exited, status=0/SUCCESS)Process: 11240 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)Main PID: 11240 (code=exited, status=0/SUCCESS)Mar 20 12:20:54 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Started Redis In-Memory Data Store.
Mar 20 12:23:14 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Stopping Redis In-Memory Data Store...
Mar 20 12:23:14 iZ8vb45ie77v5ybgcemxysZ redis-cli[12130]: Warning: Using a password with '-a' or '-u' option on the command line in... safe.
Mar 20 12:23:14 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Stopped Redis In-Memory Data Store.
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
root     12196  1416  0 12:23 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl start redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2025-03-20 12:23:31 CST; 4s agoProcess: 12130 ExecStop=/usr/local/bin/redis-cli -a 1234qwer  shutdown (code=exited, status=0/SUCCESS)Main PID: 12239 (redis-server)CGroup: /system.slice/redis.service└─12239 /usr/local/bin/redis-server 0.0.0.0:6379Mar 20 12:23:31 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Started Redis In-Memory Data Store.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    12368     1  0 12:23 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     12423  1416  0 12:23 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    12456     1  0 12:24 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     12475  1416  0 12:24 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]#
(4)解决内存过度分配(Memory Overcommit)未启用问题
11057:C 20 Mar 2025 12:20:26.509 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. 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.

从日志信息来看,Redis 提示 内存过度分配(Memory Overcommit)未启用,这可能会导致在低内存条件下后台保存(RDB 快照)或复制失败。Redis 建议启用内存过度分配以避免此类问题。


什么是内存过度分配(Memory Overcommit)?

内存过度分配是 Linux 内核的一种机制,允许系统分配比实际物理内存更多的内存。Redis 依赖于这种机制来确保在内存不足时仍能正常工作(例如,执行 RDB 快照或复制操作)。

默认情况下,Linux 内核的内存过度分配策略可能是保守的(vm.overcommit_memory = 0),这会导致 Redis 在某些情况下无法分配足够的内存。

为了永久启用内存过度分配,需要修改 /etc/sysctl.conf 文件:

  1. 打开 /etc/sysctl.conf 文件:
sudo vi /etc/sysctl.conf
  1. 在文件末尾添加以下内容:
vm.overcommit_memory = 1
  1. 保存并退出编辑器。

  2. 应用更改:

sudo sysctl -p
(5) TCP 连接队列的最大长度(即 backlog 队列)不足问题,提高系统并发性能
31867:M 20 Mar 2025 13:18:00.467 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

这个警告信息表明 Redis 在启动时尝试设置 TCP 连接的 backlog 参数为 511,但操作系统内核的 /proc/sys/net/core/somaxconn 参数值被设置为 128,低于 Redis 的配置值,因此 Redis 无法生效其配置。

:::

什么是 backlog

backlog 是 TCP 连接队列的长度,用于存储等待被 Redis 接受的客户端连接。如果连接请求的数量超过了 backlog 的值,新的连接请求可能会被拒绝。

Redis 默认的 backlog 值是 511

操作系统内核的 somaxconn 参数限制了 backlog 的最大值。
:::
:::

什么是 **somaxconn**

net.core.somaxconn 是 Linux 内核参数,用于控制 TCP 连接队列的最大长度(即 backlog 队列)。当客户端尝试连接到服务器时,如果服务器正在处理其他连接,新的连接请求会被放入 backlog 队列中,等待服务器接受。

默认值通常是 128

如果 backlog 队列已满,新的连接请求会被拒绝,客户端可能会收到 Connection refused 或超时错误。
:::

永久设置
  1. 编辑 /etc/sysctl.conf 文件:
sudo nano /etc/sysctl.conf
  1. 添加或修改以下行:
net.core.somaxconn=1024
  1. 保存并退出,然后应用更改:
sudo sysctl -p
  1. 验证修改:
cat /proc/sys/net/core/somaxconn

centos操作命令


[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis      898     1  0 11:34 ?        00:00:03 /usr/local/bin/redis-server 0.0.0.0:6379
root      1502  1416  0 11:54 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status reids
Unit reids.service could not be found.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2025-03-20 11:34:43 CST; 19min agoMain PID: 898 (redis-server)CGroup: /system.slice/redis.service└─898 /usr/local/bin/redis-server 0.0.0.0:6379Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:C 20 Mar 2025 11:34:43.508 * Configuration loaded
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 # You requested maxclients of 10000 requi...ptors.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 # Server can't set maximum open files to ...itted.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 # Current maximum open files is 4096. max...t -n'.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.509 * monotonic clock: POSIX clock_gettime
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.511 # Failed to write PID file: Permission denied
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.511 * Running mode=standalone, port=6379.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.511 # WARNING: The TCP backlog setting of 511...f 128.
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.514 * Server initialized
Mar 20 11:34:43 iZ8vb45ie77v5ybgcemxysZ redis-server[898]: 898:M 20 Mar 2025 11:34:43.517 * Ready to accept connections tcp
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# touch /var/run/redis_6379.pid
[root@iZ8vb45ie77v5ybgcemxysZ ~]# chown redis:redis /var/run/redis_6379                                                                                      .pid
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2025-03-20 12:05:30 CST; 1min 12s agoProcess: 5032 ExecStop=/usr/local/bin/redis-cli shutdown (code=exited, status=0/SUCCESS)Main PID: 5575 (redis-server)CGroup: /system.slice/redis.service└─5575 /usr/local/bin/redis-server 0.0.0.0:6379Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:C 20 Mar 2025 12:05:30.760 * Redis version=7.4.2, bits=64, commit=0...arted
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:C 20 Mar 2025 12:05:30.760 * Configuration loaded
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 # You requested maxclients of 10000 requ...tors.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 # Server can't set maximum open files to...tted.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 # Current maximum open files is 4096. ma... -n'.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.760 * monotonic clock: POSIX clock_gettime
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 * Running mode=standalone, port=6379.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 # WARNING: The TCP backlog setting of 51... 128.
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 * Server initialized
Mar 20 12:05:30 iZ8vb45ie77v5ybgcemxysZ redis-server[5575]: 5575:M 20 Mar 2025 12:05:30.761 * Ready to accept connections tcp
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis     5575     1  0 12:05 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root      6189  1416  0 12:07 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /var/run/redis_6379.pid
5575
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli shutdown
(error) NOAUTH Authentication required.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  shutdown
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
(error) ERR Errors trying to SHUTDOWN. Check logs.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  ping
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
PONG
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli
127.0.0.1:6379> auth
(error) ERR wrong number of arguments for 'auth' command
127.0.0.1:6379> auth 1234qwer
OK
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> SHUTDOWN
(error) ERR Errors trying to SHUTDOWN. Check logs.
127.0.0.1:6379> kill -9 5575
(error) ERR unknown command 'kill', with args beginning with: '-9' '5575'
127.0.0.1:6379> quit
[root@iZ8vb45ie77v5ybgcemxysZ ~]# kill -9 5575
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis     9518     1  0 12:16 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root      9549  1416  0 12:16 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /var/run/redis_6379.pid
9518
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  shutdown
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
(error) ERR Errors trying to SHUTDOWN. Check logs.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# kill -9 9518
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    11057     1  0 12:20 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     11094  1416  0 12:20 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /var/run/redis_6379.pid
11057
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli shutdown
(error) NOAUTH Authentication required.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# redis-cli -a 1234qwer  shutdown
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    11240     1  0 12:20 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     11289  1416  0 12:21 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl daemon-reload
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl stop redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: inactive (dead) since Thu 2025-03-20 12:23:14 CST; 5s agoProcess: 12130 ExecStop=/usr/local/bin/redis-cli -a 1234qwer  shutdown (code=exited, status=0/SUCCESS)Process: 11240 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)Main PID: 11240 (code=exited, status=0/SUCCESS)Mar 20 12:20:54 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Started Redis In-Memory Data Store.
Mar 20 12:23:14 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Stopping Redis In-Memory Data Store...
Mar 20 12:23:14 iZ8vb45ie77v5ybgcemxysZ redis-cli[12130]: Warning: Using a password with '-a' or '-u' option on the command line in... safe.
Mar 20 12:23:14 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Stopped Redis In-Memory Data Store.
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
root     12196  1416  0 12:23 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl start redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status redis
● redis.service - Redis In-Memory Data StoreLoaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2025-03-20 12:23:31 CST; 4s agoProcess: 12130 ExecStop=/usr/local/bin/redis-cli -a 1234qwer  shutdown (code=exited, status=0/SUCCESS)Main PID: 12239 (redis-server)CGroup: /system.slice/redis.service└─12239 /usr/local/bin/redis-server 0.0.0.0:6379Mar 20 12:23:31 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Started Redis In-Memory Data Store.
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    12368     1  0 12:23 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     12423  1416  0 12:23 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# ps -ef|grep redis
redis    12456     1  0 12:24 ?        00:00:00 /usr/local/bin/redis-server 0.0.0.0:6379
root     12475  1416  0 12:24 pts/0    00:00:00 grep --color=auto redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# sysctl -p
vm.swappiness = 0
kernel.sysrq = 1
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_slow_start_after_idle = 0
vm.overcommit_memory = 1
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]# sysctl -p
vm.swappiness = 0
kernel.sysrq = 1
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_slow_start_after_idle = 0
vm.overcommit_memory = 1
net.core.somaxconn = 1024
[root@iZ8vb45ie77v5ybgcemxysZ ~]# cat /proc/sys/net/core/somaxconn
1024
[root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl restart redis
[root@iZ8vb45ie77v5ybgcemxysZ ~]#

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/73002.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Java定时任务的三重境界:从单机心跳到分布式协调

《Java定时任务的三重境界&#xff1a;从单机心跳到分布式协调》 本文将以生产级代码标准&#xff0c;揭秘Java定时任务从基础API到分布式调度的6种实现范式&#xff0c;深入剖析ScheduledThreadPoolExecutor与Quartz Scheduler的线程模型差异&#xff0c;并给出各方案的性能压…

QT QML实现音频波形图进度条,可点击定位或拖动进度

前言 本项目实现了使用QT QML创建一个音频波形图进度条的功能。用户可以在界面上看到音频波形图&#xff0c;并且可以点击进度条上的位置进行定位&#xff0c;也可以拖动进度条来调整播放进度。可以让用户更方便地控制音频的播放进度&#xff0c;并且通过音频波形图可以直观地…

高速网络包处理,基础网络协议上内核态直接处理数据包,XDP技术的原理

文章目录 预备知识TCP/IP 网络模型&#xff08;4层、7层&#xff09;iptables/netfilterlinux网络为什么慢 DPDKXDPBFPeBPFXDPXDP 程序典型执行流通过网络协议栈的入包XDP 组成 使用 GO 编写 XDP 程序明确流程选择eBPF库编写eBPF代码编写Go代码动态更新黑名单 预备知识 TCP/IP…

[每周一更]-(第137期):Go + Gin 实战:Docker Compose + Apache 反向代理全流程

文章目录 **1. Go 代码示例&#xff08;main.go&#xff09;****2. Dockerfile 多段构建**3.构建 Docker 镜像**4. docker-compose.yml 直接拉取镜像****5. 运行容器****6. 测试 API**7、配置域名访问**DNS解析&#xff1a;将域名转换为IP地址****DNS寻址示例** 8.错误记录 访问…

Qt之MVC架构MVD

什么是MVC架构&#xff1a; MVC模式&#xff08;Model–view–controller&#xff09;是软件工程中的一种软件架构模式&#xff0c;把软件系统分为三个基本部分&#xff1a;模型&#xff08;Model&#xff09;、视图&#xff08;View&#xff09;和控制器&#xff08;Controll…

(C语言)理解 回调函数 和 qsort函数

一. 回调函数 1. 什么是回调函数&#xff1f; 回调函数&#xff08;Callback Function&#xff09;是通过 函数指针 调用的函数。其本质是&#xff1a; 将函数作为参数传递给另一个函数&#xff0c;并在特定条件下被调用&#xff0c;实现 反向控制。 2. 回调函数的使用 回调函…

vscode记录

vs code 下载安装&#xff0c;git 配置&#xff0c;插件安装_vscode安装git插件-CSDN博客 手把手教你在VS Code中使用 Git_vscode如何输入git命令-CSDN博客 VS Code | 如何快速重启VS Code&#xff1f;_vscode 怎么一键全部重启-CSDN博客 1&#xff0c;安装插件与git集成 2&am…

大数据学习(80)-数仓分层

&#x1f34b;&#x1f34b;大数据学习&#x1f34b;&#x1f34b; &#x1f525;系列专栏&#xff1a; &#x1f451;哲学语录: 用力所能及&#xff0c;改变世界。 &#x1f496;如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏⭐️留言&#x1f4dd;支持一…

数智读书笔记系列021《大数据医疗》:探索医疗行业的智能变革

一、书籍介绍 《大数据医疗》由徐曼、沈江、余海燕合著&#xff0c;由机械工业出版社出版 。徐曼是南开大学商学院副教授&#xff0c;在大数据驱动的智能决策研究领域颇有建树&#xff0c;尤其在大数据驱动的医疗与健康决策方面有着深入研究&#xff0c;曾获天津优秀博士论文、…

SpringSecurity——前后端分离登录认证

SpringSecurity——前后端分离登录认证的整个过程 前端&#xff1a; 使用Axios向后端发送请求 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>登录</title><script src"https://cdn…

qt下载和安装教程国内源下载地址

qt不断在更新中&#xff0c;目前qt6日渐成熟&#xff0c;先前我们到官方下载或者国内镜像直接可以下载到exe文件安装&#xff0c;但是最近几年qt官方似乎在逐渐关闭旧版本下载通道&#xff0c;列为不推荐下载。但是qt5以其广泛使用和稳定性&#xff0c;以及积累大量代码使得qt5…

Mysql架构理论部分

Mysql架构是什么&#xff1f;实际可以理解为执行一条sql语句所要经历的阶段有哪些&#xff01; 1.连接层 &#xff08;1&#xff09;客户端发起连接 客户端通过TCP/IP、Unix Socket或命名管道等方式向Mysql服务器发起链接请求 想要了解tcp与udp的区别&#xff0c;可以参考这…

架构师面试(十九):IM 架构

问题 IM 系统从架构模式上包括 【介绍人模式】和 【代理人模式】。介绍人模式也叫直连模式&#xff0c;消息收发不需要服务端的参与&#xff0c;即客户端之间直连的方式&#xff1b;代理人模式也叫中转模式&#xff0c;消息收发需要服务端进行中转。 下面关于这两类模式描述的…

【服务器】RAID0、RAID1、RAID5、RAID6、RAID10异同与应用

目录 ​编辑 一、RAID概述 1.1 磁盘阵列简介 1.2 功能 二、RAID级别 2.1 RAID 0&#xff08;不含校验与冗余的条带存储&#xff09; 2.2 RAID1&#xff08;不含校验的镜像存储&#xff09; 2.3 RAID 5 &#xff08;数据块级别的分布式校验条带存储&#xff09; 4、RAI…

MySQL身份验证的auth_socket插件

在Ubuntu 20.04 LTS上&#xff0c;MySQL 8.0默认使用auth_socket插件进行身份验证&#xff0c;可能存在意想不到的情况。 一、auth_socket插件 在使用sudo mysql或通过sudo切换用户后执行任何MySQL命令时&#xff0c;不需要输入密码或错误密码都可以正常登入mysql数据库&…

使用Python在Word中创建、读取和删除列表 - 详解

目录 工具与设置 Python在Word中创建列表 使用默认样式创建有序&#xff08;编号&#xff09;列表 使用默认样式创建无序&#xff08;项目符号&#xff09;列表 创建多级列表 使用自定义样式创建列表 Python读取Word中的列表 Python从Word中删除列表 在Word中&#xff…

软考-软件设计师-计算机网络

一、七层模型 中继器&#xff1a;信号会随着距离的增加而逐渐衰减&#xff0c;中继器可以接受一端的信息再将其原封不动的发给另一端&#xff0c;起到延长传输距离的作用&#xff1b; 集线器&#xff1a;多端口的中继器&#xff0c;所有端口公用一个冲突域&#xff1b; 网桥&…

关于Flask框架30道面试题及解析

文章目录 基础概念1. 什么是Flask?其核心特性是什么?2. Flask和Django的主要区别?3. 解释Flask中的“路由”概念。如何定义动态路由?核心组件4. Flask的请求上下文(Request Context)和应用上下文(Application Context)有什么区别?5. 如何访问请求参数?POST和GET方法的…

C++20 中 `constexpr` 的强大扩展:算法、工具与复数库的变革

文章目录 一、constexpr 在 <algorithm> 中的应用1. 编译时排序2. 编译时查找 二、constexpr 在 <utility> 中的应用1. 编译时交换2. 编译时条件交换 三、constexpr 在 <complex> 中的应用1. 编译时复数运算 四、总结 C20 对 constexpr 的增强是其最引人注目…

conda create之后,以前的conda env list 只能看到环境路径 没有环境名称了

1.命令 conda env list 看到的显示如下&#xff1a; 左边这列的"base"&#xff0c;指向的路径和其它环境变量安装的路径不一致。 这时需要通过"activate [anaconda的环境路径]"和"source activate"回到anaconda&#xff1a; 2.执行切换命令 …