当前位置: 首页 > news >正文

《Linux运维总结:基于银河麒麟V10+ARM64架构CPU源码编译部署单实例redis7.2.6》

总结:整理不易,如果对你有帮助,可否点赞关注一下?

更多详细内容请参考:《Linux运维篇:Linux系统运维指南》


一、环境信息

环境信息如下:

主机IP 操作系统 Redis版本 CPU架构
192.168.1.111 Kylin Linux Advanced Server V10 (Tercel) 7.2.6 4.19.90-17.5.ky10.aarch64

二、创建启动用户

[root@localhost ~]# groupadd --gid 1301 redis
[root@localhost ~]# useradd -u 1301 -g 1301 -d /home/redis -s /usr/sbin/nologin -m redis

三、编译安装

1、安装环境依赖

[root@localhost ~]# yum install gcc make glibc-devel openssl-devel systemd-devel tcl -y

2、安装包下载

[root@localhost ~]# wget https://download.redis.io/releases/redis-7.2.6.tar.gz

3、把redis安装到指定目录

[root@localhost ~]# tar axf redis-7.2.6.tar.gz
[root@localhost ~]# cd redis-7.2.6
# 启用对systemd的支持
[root@localhost redis-7.2.6]# BUILD_WITH_SYSTEMD=yes
[root@localhost redis-7.2.6]# make install PREFIX=/opt/redis7

说明:这时候,我们就能在/opt/redis7下面看到一个bin目录,redis的可执行文件都被复制到这里。

4、创建配置文件目录、数据目录、日志目录

[root@localhost ~]# mkdir /opt/redis7/conf
[root@localhost ~]# mkdir /opt/redis7/data
[root@localhost ~]# mkdir /opt/redis7/logs

5、目录授权

[root@localhost ~]# chown redis:redis /opt/redis7 -R
[root@localhost ~]# chmod 755 /opt/redis7

说明:由于银河麒麟V10操作系统新创建目录权限均是最小化,如果你创建的目录是多级目录,请确保redis7的上层目录权限为755,比如,你创建的数据目录为/data/basic-data/redis/data,请确保/data/basic-data/redis/data这四层目录的每一层目录权限均为755。

6、把redis执行文件加入到path中

[root@localhost ~]# vim /etc/profile
export REDIS_HOME=/opt/redis7
export PATH=$PATH:$REDIS_HOME/bin
[root@localhost ~]# source /etc/profile

7、修改redis配置文件

参考:redis配置文件详解

[root@localhost ~]# cp redis-7.2.6/redis.conf /opt/redis7/conf/redis.conf
[root@localhost ~]# vim /opt/redis7/conf/redis.conf
bind 127.0.0.1 192.168.1.111
protected-mode yes
port 47000
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised systemd
pidfile /var/run/redis.pid
loglevel notice
logfile "/opt/redis7/logs/redis.log"
databases 16
always-show-logo no
set-proc-title yes
proc-title-template "{title} {listen-addr} {server-mode}"
locale-collate ""
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /opt/redis7/data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync yes
repl-diskless-sync-delay 5
repl-diskless-sync-max-replicas 0
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
requirepass JHFkjSXYK6eXF3L3
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
lazyfree-lazy-user-flush no
oom-score-adj no
oom-score-adj-values 0 200 800
disable-thp yes
appendonly yes
appendfilename "appendonly.aof"
appenddirname "appendonlydir"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
aof-timestamp-enabled no
 
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-listpack-entries 512
hash-max-listpack-value 64
list-max-listpack-size -2
list-compress-depth 0
set-max-intset-entries 512
set-max-listpack-entries 128
set-max-listpack-value 64
zset-max-listpack-entries 128
zset-max-listpack-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
ignore-warnings ARM64-COW-BUG

四、配置systemd管理redis

[root@localhost ~]# vim /etc/systemd/system/redis.service 
[Unit]
Description=Redis Server
After=network.target
[Service]
User=redis
Group=redis
Type=notify
LimitNOFILE=65535
ExecStart=/opt/redis7/bin/redis-server /opt/redis7/conf/redis.conf
ExecStop=/bin/kill -s QUIT $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

五、启动redis服务

[root@localhost ~]#  systemctl daemon-reload && systemctl start redis && systemctl enable redis

总结:整理不易,如果对你有帮助,可否点赞关注一下?

更多详细内容请参考:《Linux运维篇:Linux系统运维指南》

http://www.dtcms.com/a/96887.html

相关文章:

  • 基础认证-单选题(一)
  • Golang 的 GMP 调度机制常见问题及解答
  • 刘裕的简介
  • ResNet(残差网络)中的残差是什么?
  • 今日行情明日机会——20250328
  • zynq7000 + ucos3 + lwip202_v1_2调试过程
  • 从混乱思绪到清晰表达:记录想法如何改变你的学习人生
  • Problem A: 计算奇数和
  • 央视少儿APP V2.6.2
  • (Kotlin)Android 自定义蓝牙扫描动画:多波浪扩散效果
  • acwing 每日一题4888. 领导者
  • 19款超级华丽动画的图片轮播HTML5+CSS3模板源码
  • Linux驱动开发--SPI子系统
  • Electron应用生命周期全解析:从启动到退出的精准掌控
  • python 将mkv格式视频转换成mp4格式
  • 禅道品牌全面战略升级:开创项目管理国产化替代新格局
  • VLAN 聚合
  • 最短路径题目练习
  • 内核、进程和线程---操作系统
  • Audacity Nyquist插件开发:插件标头详解
  • pnpm node_modules 高效删除
  • BAPLIE船图文件:EDI 核心字段与应用场景解析
  • 一维码与二维码的全面区别及选择指南:详解优劣势与应用
  • HCIP VRRP MSTP 交换综合实验
  • 小测验——合并多个网格文件调用相机参数进行适配
  • Baklib企业CMS的核心组成是什么?
  • 第J8周:Inception v1算法实战与解析
  • 【强化学习】基于深度强化学习的微能源网能量管理与优化策略研究【Python】
  • 2019 CCF CSP-S2.Emiya 家今天的饭
  • [识记]Mysql8 远程授权