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
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
daemonize yes
protected-mode no
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=$(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-server ./redis.conf

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

参考资料

Original: https://www.cnblogs.com/Candies/p/16567662.html
Author: Candyメ奶糖
Title: RHEL7.9安装Podman4.1.1并部署Redis集群

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/574315/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • Mybatis 插入数据后,自动返回其主键值

    Vo实体类: controller 层: service 层: serviceImpl 层: mapper 层: mapper.xml 文件: 插入数据的主键值其实是赋值给你指定的…

    Java 2023年6月9日
    071
  • 7.Hystrix缓存特性及请求特性

    Hystrix请求缓存 Hystrix支持将请求结果进行本地缓存 通过实现getCacheKey方法来判断是否取出缓存 请求缓存要求请求必须在同一个上下文 可以用过RequestC…

    Java 2023年6月8日
    062
  • 二、哨兵集群

    前面redis的集群已经搭好了,但是主redis宕机了,并不会容灾切换,所以就需要配置哨兵。至于为什么需要3个哨兵,此时就有的说道了,哈哈哈~~~~~~~ 首先说说什么是redis…

    Java 2023年6月5日
    073
  • FFmpeg使用中经验总结

    命令摘抄自网络,最下面的图片和视频的操作是经过学习之后自己的使用心得。 我的需求是,把图片按照固定时间间隔生成视频,同时还要对视频进行切割,切割条件是根据背景图片的高度来裁剪,宽度…

    Java 2023年6月5日
    094
  • easypoi一行代码搞定excel导入导出

    java;gutter:true; import cn.afterturn.easypoi.excel.annotation.Excel;</p> <p>i…

    Java 2023年6月5日
    043
  • 10、线程强制执行jion

    10、线程强制执行jion java;gutter:true; package com.testthread1;</p> <p>public class T…

    Java 2023年6月8日
    080
  • POI往word模板中写入数据

    word导出excel表格自适应宽度 https://www.cnblogs.com/libin6505/p/10339045.html Word 模板引擎,基于Apache po…

    Java 2023年5月29日
    094
  • 关于如何准备CKA考试

    最近(2019年4月)通过了CKA考试,在此分享一下考试心得。 CKA全称Certified Kubernetes Administrator,是一门在线考试,全程需要向考官分享摄…

    Java 2023年6月5日
    091
  • fastposter 2.1.1 紧急版本发布 电商级海报生成器

    fastposter 2.1.1 紧急版本发布 电商级海报生成器 fastposter低代码海报生成器,一分钟完成海报开发。支持 Java Python PHP Go JavaSc…

    Java 2023年6月5日
    0103
  • Java学习 (12)Java流程控制篇(03)循环结构

    While 循环 *while 是最基本的循环结构,结构为 public static void main(String[] args) { while (布尔表达式){ //循环…

    Java 2023年6月8日
    083
  • Java 基础(类的加载与ClassLoader的理解)

    当程序主动使用某个类时,如果该类还未被加载到内存中,则系统会通过如下三个步骤来对该类进行初始化 加载 将class文件字节码内容加载到内存中,并将这些静态数据转换成方法区的运行时数…

    Java 2023年5月29日
    0101
  • SpringCloud入门介绍

    一、什么是微服务 微服务架构是一种架构风格和架构思想,将系统业务按照功能拆分为更加细粒度的服务,所拆分的每一个服务都是一个独立的应用,这些应用对外提供公共的API,可以独立承担对外…

    Java 2023年5月30日
    068
  • SpringMVC完整版详解

    1.回顾MVC 1.1什么是MVC MVC是模型(Model)、视图(View)、控制器(Controller)的简写,是一种软件设计规范。 是将业务逻辑、数据、显示分离的方法来组…

    Java 2023年6月14日
    081
  • Apache Lucene 4.5 发布,Java 搜索引擎

    Apache Lucene 4.5 发布了,该版本提供基于磁盘的文档值以及改进了过滤器的缓存。Lucene 4.5 的文档请看这里。 Lucene 是apache软件基金会一个开放…

    Java 2023年5月29日
    076
  • Linux源码安装RabbitMQ高可用集群

    1.环境说明 linux版本:CentOS Linux release 7.9.2009 erlang版本:erlang-24.0 rabbitmq版本:rabbitmq_serv…

    Java 2023年6月7日
    073
  • Effective Java 第三版——89. 对于实例控制,枚举类型优于READRESOLVE

    Tips书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code注意,书中的有些代码里方法是基于Java 9…

    Java 2023年5月29日
    077
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球