在华为鲲鹏OpenEuler20.03系统上安装Redis, Zookeeper, Nginx

简介: 在华为鲲鹏OpenEuler20.03系统上安装Redis, Zookeeper, Nginx

背景


这里实验用的华为云鲲鹏服务器配置如下:


Huawei Kunpeng 920 2.6GHz
4vCPUs | 8GB
openEuler 20.03 64bit with ARM

连接机器后,先查看系统相关信息,注意这里是 aarch64 的,后续软件包也需要是 aarch64 版本的。

# 查看系统内核信息
[root@ecs-kunpeng-0005 ~]# uname -a
Linux ecs-kunpeng-0005 4.19.90-2003.4.0.0036.oe1.aarch64 #1 SMP Mon Mar 23 19:06:43 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
# 查看系统版本信息
[root@ecs-kunpeng-0005 ~]# cat /etc/os-release
NAME="openEuler"
VERSION="20.03 (LTS)"
ID="openEuler"
VERSION_ID="20.03"
PRETTY_NAME="openEuler 20.03 (LTS)"
ANSI_COLOR="0;31"


安装Redis


  • 下载安装


  1. 下载:https://redis.io/download


  1. 上传:redis-6.2.3.tar.gz到服务器
# 解压
[root@ecs-kunpeng-0006 local]# tar -xvf redis-6.2.3.tar.gz
[root@ecs-kunpeng-0006 local]# mv redis-6.2.3 redis
[root@ecs-kunpeng-0006 local]# cd redis
# 编译
[root@ecs-kunpeng-0006 redis]# make
# 安装
[root@ecs-kunpeng-0006 redis]# make PREFIX=/usr/local/redis install
# 指定配置文件自动,这里配置了端口号为6380
[root@ecs-kunpeng-0006 redis]# bin/redis-server ./redis.conf
612260:C 17 May 2021 14:36:19.264 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
612260:C 17 May 2021 14:36:19.264 # Redis version=6.2.3, bits=64, commit=00000000, modified=0, pid=612260, just started
612260:C 17 May 2021 14:36:19.264 # Configuration loaded
612260:M 17 May 2021 14:36:19.264 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6380
 |    `-._   `._    /     _.-'    |     PID: 612260
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               
612260:M 17 May 2021 14:36:19.265 # Server initialized
612260:M 17 May 2021 14:36:19.265 # WARNING Your kernel has a bug that could lead to data corruption during background save. Please upgrade to the latest stable kernel.
612260:M 17 May 2021 14:36:19.265 # Redis will now exit to prevent data corruption. Note that it is possible to suppress this warning by setting the following config: ignore-warnings ARM64-COW-BUG

上面 Redis Server 启动后又停止了,并且报了一个警告: Your kernel has a bug that could lead to data corruption during background save. Please upgrade to the latest stable kernel. 并且,给了解决的建议,即在 redis.conf 中取消这最后一条注释: ignore-warnings ARM64-COW-BUG

# 编辑vi redis.conf ,取消最后一行相关注释
[root@ecs-kunpeng-0006 redis]# vi redis.conf 
ignore-warnings ARM64-COW-BUG
# 尝试启动
[root@ecs-kunpeng-0006 redis]# bin/redis-server ./redis.conf
615117:C 17 May 2021 14:36:47.889 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
615117:C 17 May 2021 14:36:47.889 # Redis version=6.2.3, bits=64, commit=00000000, modified=0, pid=615117, just started
615117:C 17 May 2021 14:36:47.889 # Configuration loaded
615117:M 17 May 2021 14:36:47.890 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6380
 |    `-._   `._    /     _.-'    |     PID: 615117
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               
615117:M 17 May 2021 14:36:47.890 # Server initialized
615117:M 17 May 2021 14:36:47.891 # WARNING Your kernel has a bug that could lead to data corruption during background save. Please upgrade to the latest stable kernel.
615117:M 17 May 2021 14:36:47.891 * Ready to accept connections

启动成功๑乛◡乛๑

  • 远程访问
# 注释第75行的bind,同时将94行的protected-mode由yes改为no
[root@ecs-kunpeng-0006 redis]# vi redis.conf
75 #bind 127.0.0.1 -::1
94 protected-mode no
  • 后台启动
# 将257行的daemonize由no改为yes
[root@ecs-kunpeng-0006 redis]# vi redis.conf
257 daemonize yes
  • 开启认证
# 将901行的requirepass开启,改为自己的密码
[root@ecs-kunpeng-0006 redis]# vi redis.conf
901 requirepass your-guess
  • 停止服务
# 无密码停止服务
[root@ecs-kunpeng-0006 redis]# bin/redis-cli -h 127.0.0.1 -p 6380 shutdown
# 带密码停止服务
[root@ecs-kunpeng-0006 redis]# bin/redis-cli -a 密码 -h 127.0.0.1 -p 6380 shutdown
  • 配置日志

以后台方式启动后,发现 Redis 的日志完全没了。。所以需要配置下日志路径。

[root@ecs-kunpeng-0006 redis]# vi 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 "/usr/local/redis/log/redis.log"
# 需要手动创建目录,redis.log文件在下次启动时则会自动创建
[root@ecs-kunpeng-0006 redis]# mkdir log
# 启动即可
[root@ecs-kunpeng-0006 redis]# bin/redis-server ./redis.conf

Note: Redis 默认端口为 6379 ,我这里改了端口为 6380


安装Zookeeper


# 下载
[root@ecs-kunpeng-0001 local]# wget https://mirrors.bfsu.edu.cn/apache/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz
# 解压
[root@ecs-kunpeng-0001 local]# tar -xvf apache-zookeeper-3.6.3-bin.tar.gz
[root@ecs-kunpeng-0001 local]# mv apache-zookeeper-3.6.3-bin zookeeper
[root@ecs-kunpeng-0001 zookeeper]# cp conf/zoo_sample.cfg conf/zoo.cfg
# 配置数据与日志目录,zk在第一次启动时会自动创建
[root@ecs-kunpeng-0001 zookeeper]# vi conf/zoo.cfg 
dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/log
# 尝试启动
[root@ecs-kunpeng-0001 zookeeper]# bin/zkServer.sh start
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
# 查看状态
[root@ecs-kunpeng-0001 zookeeper]# bin/zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone


安装Nginx


配置好源后,这里使用 yum 或者 dnf 来安装 Nginx

# yum安装nginx
[root@ecs-kunpeng-0001 ~]# yum install nginx
[root@ecs-kunpeng-0001 ~]# nginx -v
nginx version: nginx/1.16.1
# 配置服务
[root@ecs-kunpeng-0001 ~]# vi /etc/nginx/nginx.conf
# 加载配置
[root@ecs-kunpeng-0001 ~]# nginx -s reload
nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size

在重新加载配置时有个警告:

nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
# 编辑vi /etc/nginx/nginx.conf,在http下增加配置:types_hash_bucket_size 1024;
[root@ecs-kunpeng-0001 ~]# vi /etc/nginx/nginx.conf
types_hash_bucket_size 1024
# 测试配置
[root@ecs-kunpeng-0001 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# 查看Nginx状态,active
[root@ecs-kunpeng-0001 ~]# service nginx status

image.png


相关实践学习
通义万相文本绘图与人像美化
本解决方案展示了如何利用自研的通义万相AIGC技术在Web服务中实现先进的图像生成。
7天玩转云服务器
云服务器ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,可降低 IT 成本,提升运维效率。本课程手把手带你了解ECS、掌握基本操作、动手实操快照管理、镜像管理等。了解产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
6月前
|
关系型数据库 应用服务中间件 nginx
Docker一键安装中间件(RocketMq、Nginx、MySql、Minio、Jenkins、Redis)
本系列脚本提供RocketMQ、Nginx、MySQL、MinIO、Jenkins和Redis的Docker一键安装与配置方案,适用于快速部署微服务基础环境。
|
3月前
|
NoSQL 算法 Redis
【Docker】(3)学习Docker中 镜像与容器数据卷、映射关系!手把手带你安装 MySql主从同步 和 Redis三主三从集群!并且进行主从切换与扩容操作,还有分析 哈希分区 等知识点!
Union文件系统(UnionFS)是一种**分层、轻量级并且高性能的文件系统**,它支持对文件系统的修改作为一次提交来一层层的叠加,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem) Union 文件系统是 Docker 镜像的基础。 镜像可以通过分层来进行继承,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
539 5
|
9月前
|
NoSQL 数据可视化 关系型数据库
安装 Redis
本文主要介绍了Linux系统下Redis的安装步骤,包括卸载旧版本、下载新版本、编译安装以及配置启动等详细操作,并解释了Redis默认端口6379的由来。同时,文章还简要说明了Windows环境下Redis的下载与服务安装方法。最后,推荐了几款Redis可视化管理工具,如RedisView、QuickRedis、AnotherRedisDesktopManager和RedisPlus,提供了它们的功能特点及下载链接,方便用户根据需求选择合适的工具进行数据库管理。
629 1
|
8月前
|
应用服务中间件 Linux 网络安全
技术指南:如何把docsify项目部署到基于CentOS系统的Nginx中。
总结 与其他部署方法相比,将docsify项目部署到基于CentOS系统的Nginx中比较简单。以上步骤应当帮助你在不花费太多时间的情况下,将你的项目顺利部署到Nginx中。迈出第一步,开始部署你的docsify项目吧!
348 14
|
8月前
|
消息中间件 NoSQL Linux
Redis的基本介绍和安装方式(包括Linux和Windows版本),以及常用命令的演示
Redis(Remote Dictionary Server)是一个高性能的开源键值存储数据库。它支持字符串、列表、散列、集合等多种数据类型,具有持久化、发布/订阅等高级功能。由于其出色的性能和广泛的使用场景,Redis在应用程序中常作为高速缓存、消息队列等用途。
939 16
|
8月前
|
JSON NoSQL Redis
在Rocky9系统上安装并使用redis-dump和redis-load命令的指南
以上步骤是在Rocky9上使用redis-dump和redis-load命令顺利出行的秘籍。如果在实行的过程中,发现了新的冒险和挑战,那么就像一个勇敢的航海家,本着探索未知的决心,解决问题并前进。
265 14
|
10月前
|
NoSQL Ubuntu 网络安全
在 Ubuntu 20.04 上安装和配置 Redis
在 Ubuntu 20.04 上安装和配置 Redis 的步骤如下:首先更新系统包,然后通过 `apt` 安装 Redis。安装后,启用并启动 Redis 服务,检查其运行状态。可选配置包括修改绑定 IP、端口等,并确保防火墙设置允许外部访问。最后,使用 `redis-cli` 测试 Redis 功能,如设置和获取键值对。
454 1
|
10月前
|
NoSQL Java Redis
微服务——SpringBoot使用归纳——Spring Boot 中集成Redis——Redis 安装
本教程介绍在 VMware 虚拟机(CentOS 7)或阿里云服务器中安装 Redis 的过程,包括安装 gcc 编译环境、下载 Redis(官网或 wget)、解压安装、修改配置文件(如 bind、daemonize、requirepass 等设置)、启动 Redis 服务及测试客户端连接。通过 set 和 get 命令验证安装是否成功。适用于初学者快速上手 Redis 部署。
295 0
|
NoSQL 关系型数据库 Redis
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
350 14
|
12月前
|
关系型数据库 MySQL 应用服务中间件
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
410 7