RHEL7.9安装Podman4.1.1并部署Redis集群
原文链接:RHEL7.9安装Podman4.1.1并部署Redis集群-语雀
环境
- 操作系统
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
- OS Kernel
cat /proc/version
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@x86-vm-26.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Aug 18 14:50:17 EDT 2020
- 节点
| IP Addr | hostname |
| --- | --- |
| 192.168.1.19 | node19 |
| 192.168.1.21 | node21 |
| 192.168.1.23 | node23 |
| 192.168.1.25 | node25 |
| 192.168.1.27 | node27 |
| 192.168.1.29 | node29 |
cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.19 node19
192.168.1.21 node21
192.168.1.23 node23
192.168.1.25 node25
192.168.1.27 node27
192.168.1.29 node29
挂载cdrom并配置yum源
# 确认存在光盘设备
ll /dev/cdrom
mkdir /mnt/cdrom
# 配置文件系统挂载
cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Feb 8 06:27:47 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel_tecchen-root / xfs defaults 0 0
UUID=cb77bcfb-64ea-4ad8-a30a-f9e706b6dfaf /boot xfs defaults 0 0
/dev/mapper/rhel_tecchen-swap swap swap defaults 0 0
# 配置挂载光盘
/dev/cdrom /mnt/cdrom iso9660 defaults 0 0
挂载所有设备
mount -a
# 配置yum源
cat /etc/yum.repos.d/rhel7.repo
[rhel-7]
name=rhel-7
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release
# 查看yum源
yum repolist
修改yum源
# 查找yum组件
rpm -qa | grep yum
# 卸载yum组件
rpm -e PackageKit-yum-1.1.10-2.el7.x86_64 --nodeps
rpm -e yum-rhn-plugin-2.0.1-10.el7.noarch --nodeps
rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
rpm -e yum-3.4.3-168.el7.noarch --nodeps
rpm -e yum-langpacks-0.4.2-7.el7.noarch --nodeps
rpm -e yum-utils-1.1.31-54.el7_8.noarch --nodeps
# 下载清华centos yum组件
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpm
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
# 安装yum
rpm -ivh yum-*
cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-7 - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-7 - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
安装gcc
yum install -y gcc
安装go
- The Go compilers support the following instruction sets
The Go compilers support the following instruction sets:
amd64, 386
The x86 instruction set, 64- and 32-bit.
arm64, arm
The ARM instruction set, 64-bit (AArch64) and 32-bit.
mips64, mips64le, mips, mipsle
The MIPS instruction set, big- and little-endian, 64- and 32-bit.
ppc64, ppc64le
The 64-bit PowerPC instruction set, big- and little-endian.
riscv64
The 64-bit RISC-V instruction set.
s390x
The IBM z/Architecture.
wasm
WebAssembly.
Be careful to double-check that the version of golang is new enough (i.e. go version), as of January 2022 version 1.16.x or higher is required. The current minimum required version can always be found in the go.mod file.
wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz
# wget https://studygolang.com/dl/golang/go1.18.4.linux-amd64.tar.gz
tar -C /usr/local -xvzf go1.18.4.linux-amd64.tar.gz
cat /etc/profile
export GO_HOME=/usr/local/go
export PATH=$GO_HOME/bin:$PATH
源码安装Podman
wget https://github.com/containers/podman/archive/refs/tags/v4.1.1.tar.gz
mv v4.1.1.tar.gz podman-v4.1.1.tar.gz
tar -C /usr/local -xvzf podman-v4.1.1.tar.gz
cd podman-4.1.1
make BUILDTAGS=""
sudo make install PREFIX=/usr
优化
- This system is not registered with an entitlement server. You can use subscription-manager to register.
修改/etc/yum/pluginconf.d/subscription-manager.conf的enabled为0,也可以直接使用~~sed -i s/1/0/g /etc/yum/pluginconf.d/subscription-manager.conf~~替换。
cat /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0
源码安装Redis
安装命令
wget https://github.com/redis/redis/archive/7.0.4.tar.gz
mv 7.0.4.tar.gz redis-v7.0.4.tar.gz
tar -xvzf redis-v7.0.4.tar.gz -C /usr/local/
ln -s redis-7.0.4/ redis
cd redis
make
make install
配置集群
redis.conf
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
protected-mode no
获取本机IP
ip a s
ip a s ens32
ip a s ens32 | sed -n '3p'
ip a s ens32 | sed -n '3p' | sed -r 's#^.*net (.*)/24.*#\1#g'
ip a s ens32 | sed -rn '3s#^.*net (.*)/24.*#\1#gp'
替换IP(将Redis的87行替换为bind $ip的值)
ip=$(ip a s ens32 | sed -rn '3s#^.*net (.*)/24.*#\1#gp')
sed -i "87cbind $ip" redis.conf | grep bind
sed -i "534cmasterauth redis-masterauth-pwd" redis.conf
sed -i "1036crequirepass redis-cluster-pwd" redis.conf | grep requirepass
启动redis服务
redis-server ./redis.conf
停止redis服务
redis-cli shutdown
kill `pidof redis-server`
ps -ef | grep redis
/usr/local/bin/redis-cli -h 192.168.1.29 -a redis-cluster-pwd shutdown
启动集群
redis-cli --cluster create -a redis-cluster-pwd 192.168.1.19:6379 192.168.1.21:6379 \
192.168.1.23:6379 192.168.1.25:6379 192.168.1.27:6379 192.168.1.29:6379 \
--cluster-replicas 1
/usr/local/bin/redis-server redis.conf
集群节点
[root@node25 redis]# redis-cli --cluster create -a redis-cluster-pwd 192.168.1.19:6379 192.168.1.21:6379 \
> 192.168.1.23:6379 192.168.1.25:6379 192.168.1.27:6379 192.168.1.29:6379 \
> --cluster-replicas 1
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.1.27:6379 to 192.168.1.19:6379
Adding replica 192.168.1.29:6379 to 192.168.1.21:6379
Adding replica 192.168.1.25:6379 to 192.168.1.23:6379
M: b3283f06d699f5487d98b0f041efc87cfc86c3a4 192.168.1.19:6379
slots:[0-5460] (5461 slots) master
M: 35da82be1d721be547e31dc0bc5248fa7254eeeb 192.168.1.21:6379
slots:[5461-10922] (5462 slots) master
M: 344385bc04f54870093df0c87a9b89405935f9d1 192.168.1.23:6379
slots:[10923-16383] (5461 slots) master
S: db545ccd3aaf469952e8286b8ad0db950c1c6a59 192.168.1.25:6379
replicates 344385bc04f54870093df0c87a9b89405935f9d1
S: 01b9632922069507c1e49d8b179a5c6ce8a88a7d 192.168.1.27:6379
replicates b3283f06d699f5487d98b0f041efc87cfc86c3a4
S: 1d6c25797f4a9fdcd7a72d019f9445951abe77db 192.168.1.29:6379
replicates 35da82be1d721be547e31dc0bc5248fa7254eeeb
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
..
>>> Performing Cluster Check (using node 192.168.1.19:6379)
M: b3283f06d699f5487d98b0f041efc87cfc86c3a4 192.168.1.19:6379
slots:[0-5460] (5461 slots) master
1 additional replica(s)
S: 01b9632922069507c1e49d8b179a5c6ce8a88a7d 192.168.1.27:6379
slots: (0 slots) slave
replicates b3283f06d699f5487d98b0f041efc87cfc86c3a4
M: 35da82be1d721be547e31dc0bc5248fa7254eeeb 192.168.1.21:6379
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
S: db545ccd3aaf469952e8286b8ad0db950c1c6a59 192.168.1.25:6379
slots: (0 slots) slave
replicates 344385bc04f54870093df0c87a9b89405935f9d1
M: 344385bc04f54870093df0c87a9b89405935f9d1 192.168.1.23:6379
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
S: 1d6c25797f4a9fdcd7a72d019f9445951abe77db 192.168.1.29:6379
slots: (0 slots) slave
replicates 35da82be1d721be547e31dc0bc5248fa7254eeeb
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
[root@node23 redis]# cat node-6379.conf
b3283f06d699f5487d98b0f041efc87cfc86c3a4 192.168.1.19:6379@16379 master - 0 1659967283288 1 connected 0-5460
db545ccd3aaf469952e8286b8ad0db950c1c6a59 192.168.1.25:6379@16379 slave 344385bc04f54870093df0c87a9b89405935f9d1 0 1659967285313 3 connected
35da82be1d721be547e31dc0bc5248fa7254eeeb 192.168.1.21:6379@16379 master - 0 1659967283000 2 connected 5461-10922
1d6c25797f4a9fdcd7a72d019f9445951abe77db 192.168.1.29:6379@16379 slave 35da82be1d721be547e31dc0bc5248fa7254eeeb 0 1659967284000 2 connected
01b9632922069507c1e49d8b179a5c6ce8a88a7d 192.168.1.27:6379@16379 slave b3283f06d699f5487d98b0f041efc87cfc86c3a4 0 1659967284300 1 connected
344385bc04f54870093df0c87a9b89405935f9d1 192.168.1.23:6379@16379 myself,master - 0 1659967282000 3 connected 10923-16383
vars currentEpoch 6 lastVoteEpoch 0
参考资料
- http://blog.itpub.net/31516603/viewspace-2788098/
- https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/x86_64/Packages/
- https://redis.io/docs/getting-started/installation/install-redis-from-source/
- https://redis.io/docs/manual/scaling/
- https://blog.csdn.net/Andrew0219/article/details/120429055
RHEL7.9安装Podman4.1.1并部署Redis集群的更多相关文章
- window下使用Redis Cluster部署Redis集群
日常的项目很多时候都需要用到缓存.redis算是一个比较好的选择.一般情况下做一个主从就可以满足一些比较小的项目需要.在一些并发量比较大的项目可能就需要用到集群了,redis在Windows下做集群可 ...
- laravel项目利用twemproxy部署redis集群的完整步骤
Twemproxy是一个代理服务器,可以通过它减少Memcached或Redis服务器所打开的连接数.下面这篇文章主要给大家介绍了关于laravel项目利用twemproxy部署redis集群的相关资 ...
- Redis笔记 -- 在 Centos7.4单机中部署Redis集群(二)
0x00--背景和目的 在单台PC服务器上部署Redis集群,通过不同的TCP端口启动多实例,模拟多台独立PC组成集群. 0x01--环境描述: Centos版本:CentOS Linux relea ...
- Centos6.6部署Redis集群
Centos6.6部署Redis集群 1环境准备 1环境安装redis 1安装ruby 2配置redis主从环境 3部署redis sentinel服务器 5集群使用 13当前集群环境说明 13测试功 ...
- Dubbo入门到精通学习笔记(十五):Redis集群的安装(Redis3+CentOS)、Redis集群的高可用测试(含Jedis客户端的使用)、Redis集群的扩展测试
文章目录 Redis集群的安装(Redis3+CentOS) 参考文档 Redis 集群介绍.特性.规范等(可看提供的参考文档+视频解说) Redis 集群的安装(Redis3.0.3 + CentO ...
- Centos7部署Redis集群
Redis简介 Redis(Remote Dictionary Server)是完全开源的.遵守BSD协议的.高性能的Key-Value数据库. Redis与其他Key-Value缓存产品有一下三个特 ...
- 在 Kubernetes 中部署 Redis 集群
在 Kubernetes 中部署 Redis 集群 在Kubernetes中部署Redis集群面临挑战,因为每个 Redis 实例都依赖于一个配置文件,该文件可以跟踪其他集群实例及其角色.为此,我们需 ...
- CentOS下部署Redis集群
一.部署环境 服务器三台: 10.10.15.41(配置运行两个实例,端口:6379,6380) 10.10.15.42(配置运行两个实例,端口:6381,6382) 10.10.15.43(配置运行 ...
- 利用docker部署redis集群
目录 一.首先配置redis.conf文件,... 1 1.获取配置文件... 1 2.修改各配置文件的参数... 2 二.下载redis镜像.启动容器... 2 1.创建网络... 2 2.拉取镜像 ...
- 单个机器部署redis集群模式(一键部署脚本)
一.检查机器是否安装gcc.unzip.wget 二.部署模式 #模式1: 将所有主从节点以及sentinel节点部署在同一台机器上 #模式2: 将一个数据节点和一个sentinel节点部署在一台机器 ...
随机推荐
- redis 简单整理——持久化之AOF[二十]
前言 简单介绍一下AOF. 正文 AOF(append only file)持久化:以独立日志的方式记录每次写命令, 重启时再重新执行AOF文件中的命令达到恢复数据的目的. AOF的主要作用 是解决了 ...
- 使用Elasticsearch做手机号和身份证号的模糊检索
使用Elasticsearch做手机号和身份证号的模糊检索 背景 客户想通过人名 四位数值 来检索人的信息 例如 张三 3421,例如需要检索包含张三和且手机号或者身份证里包含3421的数据 过程 e ...
- NOIP模拟四
NOIP模拟四 number 题目描述 现有 \(2^n\) 个点,点编号为 \(0\sim2^n-1\). 定义这些点的一张异或图为: 先选定一个集合 \(S\). 对于原图上编号为 \(x\) 和 ...
- DDD领域驱动设计总结和C#代码示例
DDD(领域驱动设计)是一种软件设计方法,它强调以业务领域为核心来驱动软件的设计和开发. DDD 的设计初衷是为了解决复杂业务领域的设计和开发问题,它提供了一套丰富的概念和模式,帮助开发者更好地理解和 ...
- HarmonyOS NEXT应用开发之深色跑马灯案例
介绍 本示例介绍了文本宽度过宽时,如何实现文本首尾相接循环滚动并显示在可视区,以及每循环滚动一次之后会停滞一段时间后再滚动. 效果图预览 使用说明: 1.进入页面,检票口文本处,实现文本首尾相接循环滚 ...
- 免费体验!阿里云智能LOGO帮你解决设计难题
简介:超实用!零基础搞定一个高大上的智能logo设计 新年过后,往往是大家一年中士气最足的时候,散去了年末的疲惫和emo,重燃对新一年的热情和希望. 想创业的朋友们同样意气风发,趁着新年的劲头想大干 ...
- 【视频特辑】提效神器!如何用Quick BI高效配置员工的用数权限
简介:随着企业数字化进程逐步加速,企业所产生和积累的数据资源日益增多.每当员工的用数权限发生变动,管理员都需要进行复杂繁琐的重复性配置流程,不仅耗时耗力还容易出错. 如何能便捷地对员工用数权限进行高 ...
- 内含干货PPT下载|一站式数据管理DMS及最新解决方案发布
简介: 今天主要给大家介绍一站式数据管理平台DMS以及解决方案的发布.议题包含企业数据管理当前的一些痛,DMS一站式数据管理平台以及其核心技术,实时数仓解决方案以及相应的应用实践. "数聚 ...
- [Go] panic: assignment to entry in nil map
以上错误出现在给 map 变量赋值的时候. 例如: type AbMap map[string]string var abMap AbMap abMap['a'] = 'b' 使用 map 变量需要使 ...
- 迁移 dotnet 6 提示必须将目标平台设置为 Windows 平台
我在迁移一个古老的项目为 .NET 6 框架,但是 VS 提示 error NETSDK1136 如果使用 Windows 窗体或 WPF,或者引用使用 Windows 窗体或 WPF 的项目或包,则 ...