页面“Jenkins进行持续集成”与“Redis5 cluster”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 +
=优化=
 +
==remove RDB固化==
 +
#dbfilename dump_7000.rdb
 +
=pre 常用脚本=
 +
<pre>
 +
 +
 +
cat  /data/evan/redisloop.sh
 +
#!/bin/bash
 +
#usage  redisloop.sh  rr
 +
cat  $1  | while read line
 +
do
 +
 +
redis-cli    -c  -h    172.31.22.218  -p 7000  -a hell $line
 +
redis-cli    -c  -h    172.31.22.218  -p 7001  -a hell  $line
 +
redis-cli    -c  -h  172.31.16.135  -p 7002  -a hell  $line 
 +
redis-cli    -c  -h  172.31.16.135  -p 7003  -a hell  $line
 +
redis-cli    -c  -h  172.31.23.43  -p 7004  -a hell  $line
 +
redis-cli    -c  -h  172.31.23.43  -p 7005  -a hell  $line
 +
done
 +
 +
 +
vi rr
 +
del hello_coin_limit_045617153_2
 +
del hello_coin_limit_9811460_2
 +
 +
 +
 +
  
仔细总结一下,我们会发现,除了编写代码,我们每天有相当一部分时间花在了编 译、运行单元测试、生成文档、打包和部署等烦琐且不起眼的工作上,这就是构建。如果我们现在还手工这样做,那成本也太高了,于是有人用软件的方法让这一系 列工作完全自动化,使得软件的构建可以像全自动流水线一样,只需要一条简单的命令,所有烦琐的步骤都能够自动完成,很快就能得到最终结果。
+
cat  redisin.sh
 +
#!/bin/bash
 +
redis-cli    -c  -h    172.31.22.218  -p 7000  -a hello  `cat $1`
 +
redis-cli    -c  -h    172.31.22.218  -p 7001  -a hello  `cat $1`
 +
#
 +
redis-cli    -c  -h  172.31.16.135  -p 7002  -a hello  `cat $1` #$1 # del hello_coin_list
 +
redis-cli    -c  -h  172.31.16.135  -p 7003  -a hello `cat $1` #$1 #del hello_coin_list
 +
#
 +
redis-cli    -c  -h  172.31.23.43  -p 7004  -a hello  `cat $1`#$1 #del hello_coin_list
 +
redis-cli    -c  -h  172.31.23.43  -p 7005  -a hello  `cat $1` #$1 #del hello_coin_list
  
Maven真比自己的“规范化Ant”强大?其实他不知道自己只是在重新发明轮子,Maven已经有一大把现成的插件,全世界都在用,你自己不用写任何代码!
+
</pre>
  
 +
=docker-compose=
  
=常用CI/CD=
+
==host 网络 要手工添加集群==
最最流行的,也是使用最多的Jenkins
+
同样要用firewall etc
有着持续集成DNA的ThoughtWorks GO。理念:"Deployment as pipeline" (华为容器平台应该是基于GO做的二次开发实现)
+
要优化的地方    restart  已添加 
Atlassian工具链之一的Bamboo
 
与Gitlab紧密集成的Gitlab CI
 
专为开源打造的Travis CI,与Github紧密集成
 
使用Python语言实现的Buildbot,相信Pythoner看到会喜欢
 
  
=安装=
 
== 通过docker安装==
 
[[基于Docker的Jenkins持续集成]]
 
  
==普通安装==
 
ip 192.168.0.16
 
  
 +
相关脚本和配置
 +
https://github.com/evan886/redis/tree/master/redis-cluster-docker_host
 
<pre>
 
<pre>
docker pull  jenkins
+
Usage:
+
NOTE2020
[root@localhost ~]# docker images
+
docker-compose up -d
REPOSITORY          TAG                IMAGE ID            CREATED            SIZE
 
jenkins            latest              cd14cecfdb3a        2 weeks ago        696MB
 
  
docker run --name=jenkins -it -u root -d -p 8080:8080 -p 50000:50000 -v /data/jenkins:/var/jenkins_home cd14cecfdb3a
+
#要改的地方
 +
bind  172.18.178.218 127.0.0.1
  
--name=jenkins 命名 
+
aliyu 不能 绑定外网NAT IP  bind 内网IP 然后 创建集群用 外网IP就可以了
-it  交互模式运行
 
-u root  root权限
 
-d 后台运行
 
-p 8080:8080 映射端口
 
-p 50000:50000 映射端口
 
-v /data/jenkins:/var/jenkins_home 映射目录
 
3f08dc4f3f5d  本地镜像ID  docker images name 命令可查看ID eg #docker images jenkins
 
  
 +
不然后
 +
(error) CLUSTERDOWN Hash slot not served  cluster没起来
  
#官方
+
#docker exec -it  node-7000  redis-cli -p 7000  --cluster create  10.25.196.78:7000    10.25.196.78:7001  10.25.196.78:7002  10.25.196.78:7003  10.25.196.78:7004  10.25.196.78:7005  --cluster-replicas 1
mkdir -p /data/jenkins-data
 
docker run \
 
  --name=jenkins \
 
  -u root \
 
  --rm \
 
  -d \
 
  -p 8080:8080 \
 
  -p 50000:50000 \
 
  -v /data/jenkins-data:/var/jenkins_home \
 
  -v /var/run/docker.sock:/var/run/docker.sock \
 
  jenkinsci/blueocean
 
  
 +
IP='192.168.10.193'
 +
docker exec -it  node-7000  redis-cli -p 7000  --cluster create  $IP:7000    $IP:7001  $IP:7002  $IP:7003  $IP:7004  $IP:7005  --cluster-replicas 1
  
  
#在运行docker容器时可以加如下参数来保证每次docker服务重启后容器也自动重启:
+
# #要改的地方 不要交互
$docker run --restart=always
+
echo 'masterauth passwd123d
#如果已经启动了则可以使用如下命令:
+
requirepass passwd123d' >>redis-7000.conf
$docker update --restart=always <CONTAINER ID>
 
  
  
  
登入容器:
 
docker exec -it jenkins /bin/bash
 
  
 +
check
  
 +
docker exec -it  node-7000  redis-cli -p 7000  -c  -h 483.284.7.34 -a passwd12Trttt3d
  
同步容器时间
 
在Dockerfile中加入
 
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && ntpdate cn.pool.ntp.org
 
 
容器运行后把容主机的/usr/share/zoneinfo/Asia/Shanghai 复制到容器的/etc/localtime
 
  
#先cp 到 /data/jenkins
 
cp  /usr/share/zoneinfo/Asia/Shanghai  /data/jenkins
 
  
plubs
 
Publish Over SSH
 
  
+
bind 要记得改为你要的IP  如果用0.0.0.0 那就不要127.0.0.1
Maven Integration
+
有问题多看log 目录
 +
 
 +
#这里是母机的ip 如果是三台机器 那么就有 三个 IP
 +
docker exec -it  node-7000  redis-cli -p 7000  --cluster create  ip:7000    ip:7001  ip:7002  ip:7003  ip:7004  ip:7005  --cluster-replicas 1
 +
 
 +
docker exec -it  node-7000  redis-cli -p 7000  --cluster create --cluster-replicas 1 ip:7000    ip:7001  ip:7002  ip:7003  ip:7004  ip:7005
 +
 
 +
三台母机的情形 就是每个docker-compose.yml 只启动两个 ,其它的删除就行了  201912
  
Build
 
clean install
 
 
</pre>
 
</pre>
  
 +
== 数据损坏重做 2020==
 +
<pre>
 +
内网的193机器  PHP老是搞坏,或者强行restart os  常常会有几个节点起不来 这时 只能重新做 cluster
 +
 +
data 目录下的mv 走或删除掉
 +
conf 目录下的 先去掉密码 
 +
up -d 起所有节点
 +
conf 用追加再添加回密码
 +
docker-compose restart 起回所有的节点
  
[https://jenkins.io/zh/doc/book/installing/#docker 安装Jenkins zh]
 
  
http://cn.jenkins.io/doc/book/installing/
 
  
安装请见 [[Docker入门]]
+
</pre>
  
[http://www.cnblogs.com/stulzq/p/8627360.html  使用Docker安装Jenkins]
+
==laradock方法==
 +
===相关文件===
 +
<pre>
  
[https://www.cnblogs.com/stulzq/p/9297260.html Jenkins 集群搭建]
+
#注意  网络是这个, 还有就是多台机器之间 也不太可能能这个网络 那样 容器之间的redis 是不通的
 +
NETWORKS_DRIVER=bridge
  
=jenkins使用=
+
less  docker-compose.yml
 +
### Redis Cluster evan##########################################
 +
    redis-cluster:
 +
      build: ./redis-cluster
 +
      ports:
 +
        - "${REDIS_CLUSTER_PORT_RANGE}:7000-7005"
 +
      networks:
 +
        - backend
  
 +
 +
cat  redis-cluster/Dockerfile  #注意 redis版本
 +
FROM grokzen/redis-cluster:5.0.6
 +
#FROM grokzen/redis-cluster:latest
 +
LABEL maintainer="hareku <[email protected]>"
 +
</pre>
 +
 +
=== 添加密码===
 
<pre>
 
<pre>
要先安装maven 什么的
+
添加密码 可以进入容器里面直接添加 ,不过不够好 ,有空要 放到母机出来,有如我上面
 +
004  7005  redis-cluster.tmpl redis.tmpl  sentinel.tmpl
 +
root@401a49002b88:/data# ls /redis-conf/700
 +
7000/ 7001/ 7002/ 7003/ 7004/ 7005/
 +
root@401a49002b88:/data# ls /redis-conf/7000/redis.conf
 +
/redis-conf/7000/redis.conf
 +
root@401a49002b88:/data# tail /redis-conf/7000/redis.conf
 +
bind 0.0.0.0
 +
port 7000
 +
cluster-enabled yes
 +
cluster-config-file nodes.conf
 +
cluster-node-timeout 5000
 +
appendonly yes
 +
dir /redis-data/7000
  
  
Build
+
进入redis-cluster 容器 直接非交互  这里以7005 端口为例子
Root POM pom.xml
 
Goals and options clean install
 
  
 +
redis-cli  -c  -h 127.0.0.1  -p 7005  config set masterauth 36DbRGvv66
 +
redis-cli  -c  -h 127.0.0.1  -p 7005  config set requirepass 36DbRGvv66
 +
redis-cli  -c  -h 127.0.0.1  -p 7005 auth  36DbRGvv66
  
Post Steps
+
redis-cli  -c  -h 127.0.0.1 -p 7005  -a 36DbRGvv66  config rewrite
Ex shell
+
redis-cli  -c  -h 127.0.0.-p 7005  config rewrite  # 最后这一步 有时得 加上密码
cd /var/jenkins_home/workspace/doll-api-test/target
 
scp doll-api-test.jar root@192.168.50.160:/data/update/boot/doll-api
 
  
  
sen build aritcle
 
  
ex command #记得要要全局那加ssh server
+
Usage: 可以直接用物理机的ip 内网或者外网
  
 +
上次搞了几天 ,是忙晕了 不记得打开防火墙 7000-7005的端口
 +
</pre>
  
 +
=源码手工=
 +
==单独安装redis-cli==
 +
<pre>
 +
debian 上可以单独安装 redis-cli
 +
但是rhel居然不行 只能编译一下 
 +
 +
三步曲后 make  -j  2 之后 ,copy 走这个 bin 文件就行了
 +
./src/redis-cli -c  /usr/bin/  #或者放 /usr/sbin  只有超级用户可以用到  如果其它用户要用 就不要放这里了
  
</pre>
 
  
==gradle ==
+
redis cluster 执行脚本 不用老是一个一个的搞 麻烦  其实只要在三个主上执行就行了 你6个全执行也没事,反正是脚本的
Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化建构工具。它使用一种基于Groovy的特定领域语言来声明项目设置,而不是传统的XML。
 
当前其支持的语言限于Java、Groovy和Scala,计划未来将支持更多的语言。
 
  
和maven同级,更简洁一些
+
#!/bin/bash
 +
##Usage  bash redisin.sh  你的redis脚本
 +
redis-cli    -c  -h    172.31.22.218  -p 7000  -a hello  `cat $1`
 +
redis-cli    -c  -h    172.31.22.218  -p 7001  -a hello  `cat $1`
 +
#
 +
redis-cli    -c  -h  172.31.16.135  -p 7002  -a hello  `cat $1` #$1 # del hello_list
  
  
https://docs.gradle.org/current/userguide/userguide.html
+
</pre>
  
==maven==
+
==节点信息==
 
<pre>
 
<pre>
 +
角色                        主机名                                                            IP1              IP2     
  
安装在configureTools 全局配置那里 要加上maven 和填写版本 以这个为目录名 例如下面的maven3.6.2
+
7000  7001              01                  192.168.10.211   
 +
7002  7003              02                  192.168.10.212     
 +
7004  7005              03                  192.168.10.213     
 +
</pre>
  
 +
姐妹篇 [[Redis4 cluster]]
  
 
+
==防火墙设置==
Build->Goals and options ->clean install -Pbeta -Dmaven.test.skip=true
+
<pre>
 +
第一台:
 +
firewall-cmd --permanent --add-port=7000/tcp
 +
firewall-cmd --permanent --add-port=17000/tcp
 +
firewall-cmd --permanent --add-port=7001/tcp
 +
firewall-cmd --permanent --add-port=17001/tcp
 +
firewall-cmd --reload
 +
firewall-cmd --list-all-zones
 +
第二台:
 +
firewall-cmd --permanent --add-port=7002/tcp
 +
firewall-cmd --permanent --add-port=17002/tcp
 +
firewall-cmd --permanent --add-port=7003/tcp
 +
firewall-cmd --permanent --add-port=17003/tcp
 +
firewall-cmd --reload
 +
firewall-cmd --list-all-zones
 +
第三台:
 +
firewall-cmd --permanent --add-port=7004/tcp
 +
firewall-cmd --permanent --add-port=17004/tcp
 +
firewall-cmd --permanent --add-port=7005/tcp
 +
firewall-cmd --permanent --add-port=17005/tcp
 +
firewall-cmd --reload
 +
firewall-cmd --list-all-zones
 
</pre>
 
</pre>
  
[https://blog.csdn.net/xlgen157387/article/details/68961371 Jenkins部署Maven多环境项目(dev、beta、prod)的参数设置]
+
==系统参数设置==
 +
<pre>#vi /etc/sysctl.conf
 +
echo 'vm.overcommit_memory = 1
 +
net.core.somaxconn = 1024' >>/etc/sysctl.conf
  
[https://blog.csdn.net/u011781521/article/details/76696677 Jenkins系列(三)----Maven项目配置详解]
+
/sbin/sysctl -p /etc/sysctl.conf
 +
</pre>
  
 +
==redis 5 安装==
 +
<pre>
 +
#bash redisins.sh 2>&1 | tee redislog
  
===maven 配置文件  ===
+
wget -c http://download.redis.io/releases/redis-5.0.6.tar.gz
<pre>maven 配置  可以在母机修改  注意  要先至少跑个工程后 才会安装maven 生成这个目录了
+
#set var
 +
redis_install_dir=/data/apps/redis
 +
redis_ver=5.0.6
  
有时要密码的 ,格式要小心  烦死了
+
THREAD=4
 +
tar xzf redis-${redis_ver}.tar.gz
 +
pushd redis-${redis_ver} > /dev/null
  
/data/docker/volumes/docker4jenkins_jenkins_home/_data/tools/hudson.tasks.Maven_MavenInstallation/maven/conf/settings.xml
+
make  -j ${THREAD}
  
/docker/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/jenkins-in-maven/conf下修改setting.xml文件。
+
make PREFIX=${redis_install_dir}
母机可能的目录
+
make distclean
/home/data/docker/volumes/docker4jenkins_jenkins_home/_data/tools/hudson.tasks.Maven_MavenInstallation/maven3.6.2/conf
+
#cd src && make install #这个才行 特别是cluster ? 2019年 8月16日 星期五 23时29分41秒 CST
 +
make install  PREFIX=${redis_install_dir} 
 +
echo "export PATH=${redis_install_dir}/bin/:$PATH" >> /etc/profile && source /etc/profile
  
 +
####**********************下面是老的
 +
wget -c http://download.redis.io/releases/redis-5.0.5.tar.gz
 +
redis_install_dir=/home/apps/redis
 +
redis_ver=5.0.5
  
 +
THREAD=4
 +
tar xzf redis-${redis_ver}.tar.gz
 +
pushd redis-${redis_ver} > /dev/null
 +
make  -j ${THREAD}
 +
make PREFIX=/home/apps/redis #here
 +
make distclean
 +
#cd src && make install #这个才行 特别是cluster ? 2019年 8月16日 星期五 23时29分41秒 CST
 +
make install  PREFIX=/home/apps/redis  # make install #这个有时没有创建出目录来呀
  
位置 
+
#这个我没做 根本没用 哈哈
153    <mirror>
+
#复制rb 或者放到安装的bin目录 然后再加path
154      <id>mirrorId</id>
+
#cp /opt/redis-5.0.0/src/redis-trib.rb /usr/local/bin
155      <mirrorOf>repositoryId</mirrorOf>
 
156      <name>Human Readable Name for this Mirror.</name>
 
157      <url>http://my.repository.com/repo/path</url>
 
158    </mirror>
 
159      -->
 
160 <mirror>
 
161      <id>nexus</id>
 
162      <mirrorOf>*</mirrorOf>
 
163      <url>http://192.168.4.189:8081/repository/maven-public/</url>
 
164    </mirror>
 
165  </mirrors>
 
  
 +
echo 'export PATH=/home/apps/redis/bin/:$PATH' >> /etc/profile && source /etc/profile
 +
##**********************上面是老的
 +
NOTE
 +
redis5 用redis-cli创建整个redis集群(redis5以前的版本集群是依靠ruby脚本redis-trib.rb实现
 +
</pre>
  
公用的方便安装的如下配置
+
==创建节点 ==
  <mirrors>
+
<pre>
    <!-- mirror
+
#第一台:192.168.10.211 #here
    | Specifies a repository mirror site to use instead of a given repository. The repository that
+
redis_install_dir=/data/apps/redis
    | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
+
mkdir -p ${redis_install_dir}
    | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
+
cd ${redis_install_dir}
    |
+
mkdir -p redis_cluster
    <mirror>
+
cd redis_cluster
      <id>mirrorId</id>
+
mkdir data 7000 7001
      <mirrorOf>repositoryId</mirrorOf>
 
      <name>Human Readable Name for this Mirror.</name>
 
      <url>http://my.repository.com/repo/path</url>
 
    </mirror>
 
    -->
 
    <mirror>
 
      <id>alimaven</id>
 
      <name>aliyun maven</name>
 
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
 
      <mirrorOf>central</mirrorOf>       
 
    </mirror>
 
  </mirrors>
 
  
 +
#cp /root/src/redis-5.0.5/redis.conf  ${redis_install_dir}/redis_cluster
 +
#cd  /home/apps/redis/redis_cluster
 +
#cp redis.conf 7000/redis_7000.conf
 +
#mv redis.conf  7001/redis_7001.conf
  
  
 +
#第2台:192.168.10.212
 +
redis_install_dir=/data/apps/redis
 +
mkdir -p ${redis_install_dir}
 +
cd ${redis_install_dir}
 +
mkdir -p redis_cluster
 +
cd redis_cluster
 +
mkdir data 7002 7003
  
#lx
+
#cp /root/src/redis-5.0.5/redis.conf  .
<servers>
+
#cp  redis.conf 7002/redis_7002.conf
        <server>
+
#mv redis.conf  7003/redis_7003.conf
            <id>nexus</id>
 
            <username>admin</username>
 
            <password>lxtxadmin123</password>
 
        </server>
 
    </servers>
 
  
    <mirrors>
 
        <mirror>
 
            <id>nexus</id>
 
            <mirrorOf>*</mirrorOf>
 
            <url>http://192.168.4.189:8081/repository/maven-public/</url>
 
        </mirror>
 
<!--        <mirror>-->
 
<!--            <id>nexus-aliyun</id>-->
 
<!--            <mirrorOf>central</mirrorOf>-->
 
<!--            <name>Nexus aliyun</name>-->
 
<!--            <url>http://maven.aliyun.com/nexus/content/groups/public</url>-->
 
<!--        </mirror>-->
 
  
    </mirrors>
+
#第3台:192.168.10.213
 +
redis_install_dir=/data/apps/redis
 +
mkdir -p ${redis_install_dir}
 +
cd ${redis_install_dir}
 +
mkdir -p redis_cluster
 +
cd redis_cluster
 +
mkdir data 7004 7005
 +
#cp /root/src/redis-5.0.5/redis.conf  .
 +
#cp redis.conf 7004/redis_7004.conf
 +
#mv redis.conf 7005/redis_7005.conf
  
  
 
</pre>
 
</pre>
  
[https://blog.csdn.net/xxsstf/article/details/84991931 Jenkins使用, maven插件配置修改]
+
==修改配置文件(三台机器6个配置)==
 +
<pre>
 +
note  日志在系统那  因为我们配置文件没指定 /var/log/redis/
  
 +
ls /home/apps/redis/redis_cluster/data/
 +
appendonly-7000.aof  dump_7000.rdb  nodes_7000.conf
 +
appendonly-7001.aof  dump_7001.rdb  nodes_7001.conf
 +
# 生成在这里了  /home/apps/redis/redis_cluster/data/nodes_7000.conf  nodes_7001.conf
  
[https://yq.aliyun.com/articles/752222 Maven国内可用下载速度快的仓库镜像(阿里Maven镜像地址)]
+
配置建议加上这个  下面这些配置还加上的
 +
# appendfsync always
 +
appendfsync everysec
 +
# appendfsync no
  
===snapshot快照仓库和release发布仓库===
+
第一台:
maven中的仓库分为两种,snapshot快照仓库和release发布仓库。snapshot快照仓库用于保存开发过程中的不稳定版 本,release正式仓库则是用来保存稳定的发行版本。定义一个组件/模块为快照版本,只需要在pom文件中在该模块的版本号后加上-SNAPSHOT即可(注意这里必须是大写)。release版本不允许修改,每次进行release版本修改,发布必须提升版本号。而snapshot一般是开发过程中的迭代版本,snapshot更新后,引用的项目可以不修改版本号自动下载构建。
+
pushd /home/apps/redis/redis_cluster
 +
mkdir -p /var/log/redis
 +
: > 7000/redis_7000.conf
 +
#vi 7000/redis_7000.conf
 +
#非交互进行
 +
echo 'port 7000
 +
bind 192.168.10.211 127.0.0.1
 +
cluster-enabled yes
 +
appendfilename "appendonly-7000.aof"
 +
cluster-config-file nodes_7000.conf
 +
cluster-node-timeout 15000
 +
appendonly yes
 +
appendfsync everysec
 +
daemonize yes
 +
dbfilename dump_7000.rdb
 +
dir /data/apps/redis/redis_cluster/data
 +
logfile "/var/log/redis/7000.log"
 +
protected-mode yes
 +
pidfile /var/run/redis_7000.pid'>7000/redis_7000.conf
  
[https://www.cnblogs.com/molao-doing/articles/6379216.html MAVEN snapshot快照和release发布库的区别、作用]
 
  
[https://www.cnblogs.com/EasonJim/p/6852840.html Maven快照机制(SNAPSHOT)]
+
:>7001/redis_7001.conf
 +
echo 'port 7001
 +
bind 192.168.10.211 127.0.0.1
 +
cluster-enabled yes
 +
appendfilename "appendonly-7001.aof"
 +
cluster-config-file nodes_7001.conf
 +
cluster-node-timeout 15000
 +
appendonly yes
 +
appendfsync everysec
 +
daemonize yes
 +
dbfilename dump_7001.rdb
 +
dir /home/apps/redis/redis_cluster/data
 +
logfile "/var/log/redis/7001.log"
 +
protected-mode yes
 +
pidfile /var/run/redis_7001.pid'>7001/redis_7001.conf
  
[http://www.huangbowen.net/blog/2016/01/29/understand-official-version-and-snapshot-version-in-maven/ 理解Maven中的SNAPSHOT版本和正式版本]
 
  
==git branch==
+
第二台
这里应该 填写上操作过程 在我的geany上
+
  pushd /home/apps/redis/redis_cluster
 +
mkdir -p /var/log/redis
 +
:>7002/redis_7002.conf
 +
echo 'port 7002
 +
bind 192.168.10.212 127.0.0.1
 +
cluster-enabled yes
 +
appendfilename "appendonly-7002.aof"
 +
cluster-config-file nodes_7002.conf
 +
cluster-node-timeout 15000
 +
appendonly yes
 +
appendfsync everysec
 +
daemonize yes
 +
dbfilename dump_7002.rdb
 +
dir /home/apps/redis/redis_cluster/data
 +
logfile "/var/log/redis/7002.log"
 +
protected-mode yes
 +
pidfile /var/run/redis_7002.pid' >7002/redis_7002.conf
  
[https://blog.csdn.net/jackyzheng/article/details/78750047 goodJenkins Git Parameter 插件配置过程]
+
:>7003/redis_7003.conf
 +
echo 'port 7003
 +
bind 192.168.10.212 127.0.0.1
 +
cluster-enabled yes
 +
appendfilename "appendonly-7003.aof"
 +
cluster-config-file nodes_7003.conf
 +
cluster-node-timeout 15000
 +
appendonly yes
 +
appendfsync everysec
 +
daemonize yes
 +
dbfilename dump_7003.rdb
 +
dir /home/apps/redis/redis_cluster/data
 +
logfile "/var/log/redis/7003.log"
 +
protected-mode yes
 +
pidfile /var/run/redis_7003.pid'>7003/redis_7003.conf
  
[https://my.oschina.net/u/3493518/blog/1510531 Jenkins插件之——git Parameter插件]
 
  
 +
第3台
 +
pushd /home/apps/redis/redis_cluster
 +
mkdir -p /var/log/redis
 +
:>7004/redis_7004.conf
 +
echo 'port 7004
 +
bind 192.168.10.213 127.0.0.1
 +
cluster-enabled yes
 +
appendfilename "appendonly-7004.aof"
 +
cluster-config-file nodes_7004.conf
 +
cluster-node-timeout 15000
 +
appendonly yes
 +
appendfsync everysec
 +
daemonize yes
 +
dbfilename dump_7004.rdb
 +
dir /home/apps/redis/redis_cluster/data
 +
logfile "/var/log/redis/7004.log"
 +
protected-mode yes
 +
pidfile /var/run/redis_7004.pid ' > 7004/redis_7004.conf
  
[https://blog.csdn.net/hwhua1986/article/details/53841741 Jenkins:使用Git Parameter插件实现tag或分支的选择性构建]
+
:>7005/redis_7005.conf
 +
echo 'port 7005
 +
bind 192.168.10.213 127.0.0.1
 +
cluster-enabled yes
 +
appendfilename "appendonly-7005.aof"
 +
cluster-config-file nodes_7005.conf
 +
cluster-node-timeout 15000
 +
appendonly yes
 +
daemonize yes
 +
dbfilename dump_7005.rdb
 +
dir /home/apps/redis/redis_cluster/data
 +
logfile "/var/log/redis/7005.log"
 +
protected-mode yes
 +
pidfile /var/run/redis_7005.pid' >7005/redis_7005.conf
  
[https://blog.csdn.net/u012076316/article/details/52056107 jenkins构建时支持git选择分支]
+
</pre>
  
[https://blog.csdn.net/qq_20641565/article/details/79132797 jenkins插件Git Parameter Plug-In分支构建项目]
+
==启动redis==
 +
<pre>
 +
#cd /usr/local/redis/etc/redis_cluster #on freebsd
 +
第一台: #注意用 "" 不要'' 要替换变量的值
 +
mkdir /var/log/redis
 +
redis_install_dir=/data/apps/redis
 +
echo  "redis_install_dir=/data/apps/redis
 +
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7000/redis_7000.conf
 +
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7001/redis_7001.conf">${redis_install_dir}/redis_cluster/run
  
[http://buxin-2008.iteye.com/blog/2357340 jenkins进行git多分支的docker镜像构建]
+
chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
 +
chmod  +x /etc/rc.d/rc.local
 +
echo "${redis_install_dir}/redis_cluster/run" > >/etc/rc.d/rc.local #把变量替换为值,不建议用''
  
==android==
+
第二台
[ https://blog.csdn.net/youshi520000/article/details/81027940 Android 使用 Jenkins 实现自动化打包【流程】&【踩坑]
+
mkdir /var/log/redis
 +
redis_install_dir=/data/apps/redis
 +
echo "${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7002/redis_7002.conf
 +
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7003/redis_7003.conf">${redis_install_dir}/redis_cluster/run
  
 +
chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
 +
chmod  +x /etc/rc.d/rc.local
 +
echo "${redis_install_dir}/redis_cluster/run" > >/etc/rc.d/rc.local #把变量替换为值
  
== Jenkins的初级应用(2)-Invoke Phing targets==
 
[https://www.cnblogs.com/hodge01/p/9367498.html Jenkins的初级应用(2)-Invoke Phing targets]
 
  
==启动==
+
第三台:
===supervisor===
+
mkdir /var/log/redis
<pre>
+
redis_install_dir=/data/apps/redis
#配合supervisor,把Jenkins直接变成一个服务。
+
echo "${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7004/redis_7004.conf
#可以在Linux上创建一个ci用户,然后,用supervisor启动并指定9090端口:
+
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7005/redis_7005.conf">${redis_install_dir}/redis_cluster/run
# /etc/supervisor/conf.d/ci.conf
+
 
 +
chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
 +
chmod  +x /etc/rc.d/rc.local
 +
echo "${redis_install_dir}/redis_cluster/run"  >>/etc/rc.d/rc.local #把变量替换为值
  
[program:ci]
 
command=java -jar /home/ci/jenkins.war --httpPort=9090
 
user=ci
 
autostart=true
 
autorestart=true
 
startsecs=30
 
startretries=5
 
 
</pre>
 
</pre>
  
=权限控制=
+
=登陆redis=
 +
<pre>
 +
/home/apps/redis/bin/redis-cli  -c -h  192.168.10.211 -p 7000
 +
redis-cli -h 10.3.10.141 -p 7001
  
==Role-based Authorization Strategy==
+
redis-cli -h 10.3.10.142 -p 7002
 +
redis-cli -h 10.3.10.142 -p 7003
  
  可选插件-->Role-based Authorization Strategy
+
redis-cli -h 10.3.10.143 -p 7004
 +
redis-cli -h 10.3.10.143 -p 7005
 +
</pre>
 +
==创建集群==
 +
<pre>注意:在任意一台上运行 不要在每台机器上都运行,一台就够了
 +
#要开通端口  firewalld
 +
#在geany 有: 格式可能有点不对 要注意
 +
redis-cli --cluster create --cluster-replicas 1 192.168.10.211:7000 192.168.10.211:7001 192.168.10.212:7002 192.168.10.212:7003 192.168.10.213:7004  192.168.10.213:7005
 +
#--replicas  1  表示 自动为每一个master节点分配一个slave节点    上面有6个节点,程序会按照一定规则生成 3个master(主)3个slave(从)
 +
</pre>
 +
===执行详情===
 +
<pre>
 +
[root@dev-hello-1 redis_cluster]# redis-cli --cluster create --cluster-replicas 1 192.168.10.201:7000 192.168.10.201:7001 192.168.10.202:7002 192.168.10.202:7003 192.168.10.203:7004 192.168.10.203:7005
 +
>>> 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.10.202:7003 to 192.168.10.201:7000
 +
Adding replica 192.168.10.203:7005 to 192.168.10.202:7002
 +
Adding replica 192.168.10.201:7001 to 192.168.10.203:7004
 +
M: caf3a2c83f4f34498d9152161d3d62ca499094eb 192.168.10.201:7000
 +
  slots:[0-5460] (5461 slots) master
 +
S: ecbc0c648ff15c4ff2c176563afa580c7c8b7f3b 192.168.10.201:7001
 +
  replicates 3792aae886d957e1a0272bcd198a06798f05c26d
 +
M: 9c2f0b7827180d93371b493e8ca59b6eea776b0c 192.168.10.202:7002
 +
  slots:[5461-10922] (5462 slots) master
 +
S: b66f09b38e321ce3f8ee000b7cb40fe804f3a450 192.168.10.202:7003
 +
  replicates caf3a2c83f4f34498d9152161d3d62ca499094eb
 +
M: 3792aae886d957e1a0272bcd198a06798f05c26d 192.168.10.203:7004
 +
  slots:[10923-16383] (5461 slots) master
 +
S: a027592b56eb7477fe039786490318efdda8a0d6 192.168.10.203:7005
 +
  replicates 9c2f0b7827180d93371b493e8ca59b6eea776b0c
 +
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.10.201:7000)
 +
M: caf3a2c83f4f34498d9152161d3d62ca499094eb 192.168.10.201:7000
 +
  slots:[0-5460] (5461 slots) master
 +
  1 additional replica(s)
 +
S: a027592b56eb7477fe039786490318efdda8a0d6 192.168.10.203:7005
 +
  slots: (0 slots) slave
 +
  replicates 9c2f0b7827180d93371b493e8ca59b6eea776b0c
 +
M: 3792aae886d957e1a0272bcd198a06798f05c26d 192.168.10.203:7004
 +
  slots:[10923-16383] (5461 slots) master
 +
  1 additional replica(s)
 +
M: 9c2f0b7827180d93371b493e8ca59b6eea776b0c 192.168.10.202:7002
 +
  slots:[5461-10922] (5462 slots) master
 +
  1 additional replica(s)
 +
S: ecbc0c648ff15c4ff2c176563afa580c7c8b7f3b 192.168.10.201:7001
 +
  slots: (0 slots) slave
 +
  replicates 3792aae886d957e1a0272bcd198a06798f05c26d
 +
S: b66f09b38e321ce3f8ee000b7cb40fe804f3a450 192.168.10.202:7003
 +
  slots: (0 slots) slave
 +
  replicates caf3a2c83f4f34498d9152161d3d62ca499094eb
 +
[OK] All nodes agree about slots configuration.
 +
>>> Check for open slots...
 +
>>> Check slots coverage...
 +
[OK] All 16384 slots covered.
 +
</pre>
  
 +
=查看redis集群情况=
 +
<pre>
 +
redis-cli -h 192.168.10.211 -p 7000 cluster nodes
  
超级用户 root root
+
a027592b56eb7477fe039786490318efdda8a0d6 192.168.10.203:7005@17005 slave 9c2f0b7827180d93371b493e8ca59b6eea776b0c 0 1567502665000 6 connected
other evan 
+
3792aae886d957e1a0272bcd198a06798f05c26d 192.168.10.203:7004@17004 master - 0 1567502666171 5 connected 10923-16383
group  ops java admin
+
9c2f0b7827180d93371b493e8ca59b6eea776b0c 192.168.10.202:7002@17002 master - 0 1567502664166 3 connected 5461-10922
 +
ecbc0c648ff15c4ff2c176563afa580c7c8b7f3b 192.168.10.201:7001@17001 slave 3792aae886d957e1a0272bcd198a06798f05c26d 0 1567502664000 5 connected
 +
caf3a2c83f4f34498d9152161d3d62ca499094eb 192.168.10.201:7000@17000 myself,master - 0 1567502663000 1 connected 0-5460
 +
b66f09b38e321ce3f8ee000b7cb40fe804f3a450 192.168.10.202:7003@17003 slave caf3a2c83f4f34498d9152161d3d62ca499094eb 0 1567502665169 4 connected
  
==基于项目(job)==
+
</pre>
 +
==cluster 完整性检查==
 
<pre>
 
<pre>
Project roles 创建一个 dev 只配置所以 dev开头的内网项目
 
  
Role to add  dev
+
redis-trib.rb check 10.3.10.140:7000
Pattern  dev.* #配置
+
redis-trib.rb check 10.3.10.140:7001
 +
redis-trib.rb check 10.3.10.140:7002
 +
redis-trib.rb check 10.3.10.140:7003
 +
redis-trib.rb check 10.3.10.140:7004
 +
redis-trib.rb check 10.3.10.140:7005
 +
 
 +
结果如下 16384个槽都分配到了 节点
  
选择【 Manage Roles】
+
[OK] All nodes agree about slots configuration.
在【Global roles】创建一个新的全局角色 anyone,该角色不开放系统权限,只读.
+
>>> Check for open slots...
 +
>>> Check slots coverage...
 +
[OK] All 16384 slots covered.
 +
</pre>
  
然后把你的号添加到 Global roles
+
==测试 ==
 +
<pre>
 +
 
 +
redis-cli -c -h  192.168.10.201 -p 7000
  
Assign Roles-- Item roles 里面 加入你的号 并勾上 dev
+
[root@dev-hello-1 redis_cluster]# redis-cli -c -h  192.168.10.201 -p 7000
 +
192.168.10.201:7000> set evan 36
 +
-> Redirected to slot [14924] located at 192.168.10.203:7004
 +
OK
 +
192.168.10.203:7004>
  
 +
[root@dev-hello-2 redis_cluster]# redis-cli -c -h  192.168.10.202 -p 7002
 +
192.168.10.202:7002> get evan
 +
-> Redirected to slot [14924] located at 192.168.10.203:7004
 +
"36"
 +
192.168.10.203:7004>
  
注意: Global roles 必要有 你要给别人用的用户名,不登录了什么 都没提示全局没有读权限 </pre>
+
dev-hello-3 redis_cluster]#  redis-cli -c -h  192.168.10.203  -p 7005
 +
192.168.10.203:7005> get evan
 +
-> Redirected to slot [14924] located at 192.168.10.203:7004
 +
"36"
 +
192.168.10.203:7004>
  
==权限see also==
+
测试通过了
  
[https://blog.csdn.net/Gred01/article/details/78587290 Jenkins教程四基于Role-based Authorization Strategy的用户权限管理]
 
  
[https://my.oschina.net/u/3413394/blog/1576357 enkins教程四 基于【Role-based Authorization Strategy】的用户权限管理]
 
  
[https://www.jianshu.com/p/7e148bcfb96e Jenkins使用教程之用户权限管理(包含插件的安装)]
 
  
[https://www.jianshu.com/p/6c274d9b22ad Jenkins自动化部署-权限管控篇 ()]
+
#20191113 
 +
要加 -a 密码访问  不然老是提示要密码
 +
[root@prod-02 ~]# redis-cli  -c -h 172.16.200.12 -p 7002
 +
172.16.200.12:7002> auth ci1723
 +
OK
 +
172.16.200.12:7002> get evan
 +
-> Redirected to slot [14924] located at 172.16.200.7:7004
 +
(error) NOAUTH Authentication required.
 +
172.16.200.7:7004> auth ci1723
 +
OK
 +
172.16.200.7:7004> get evan
 +
"56;"
  
=插件=
 
  
==dashboard 插件==
 
dashboard 插件 [https://wiki.jenkins-ci.org/display/JENKINS/Dashboard+View Dashboard View]
 
用来自定义自己的主页,例如对下列的 jenkins 的主页
 
  
== Wall display==
 
用来将 jobs 的状态更加直观地显示在大屏幕上
 
  
=== ssh server===
+
</pre>
  
====troubleshooting====
+
=添加redis集群密码=
<pre>
+
==方式一:修改所有Redis集群中的redis.conf文件加入==  
 +
<pre>  
 +
#不要交互
 +
echo 'masterauth passwd123d
 +
requirepass passwd123d' >>redis-7000.conf
  
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [win8r2]. Message [USERAUTH fail]]
 
在jenkins 上使用publish over ssh ,报上述错误,
 
  
ssh server
 
1. 配置里面添加 jenkins pri key  2.远程被 jenkins 的远程那里添加jenkin的pub key 
 
  
 +
# NOTE  还是这个办法好  不然可能有些 没加载到配置文件去呢
 +
masterauth passwd123
 +
requirepass passwd123
 +
说明:这种方式需要重新启动各节点
 
</pre>
 
</pre>
https://ask.csdn.net/questions/379784
 
  
=NODE=
+
==方式二:进入各个实例进行设置  就是所有节点:不建议==
[https://blog.csdn.net/wanchaopeng/article/details/87934293 jenkins打包nodejs]
+
<pre>
 +
redis-cli -c -h 10.3.10.141 -p 7001
 +
#好像不能一起执行
 +
config set masterauth 36DbRGvv
 +
config set requirepass 36DbRGvv
 +
auth  36DbRGvv
 +
config rewrite
 +
 
 +
添加redis集群密码 一开始忘记加-c 导致 143 两个都加不上了  redis本身的密码这样就有了
  
[https://www.cnblogs.com/vipzhou/p/7890016.html jenkins学习之自动打包构建nodejs应用]
+
-a 后 再执行命令就再 auth , 而如果是进入后 auth password 要每次 都再验证一下密码 麻烦
  
=xk=
 
<pre>
 
dev 开发环境
 
beta 测试环境
 
release 正式环境
 
 
</pre>
 
</pre>
  
=DB =
+
=redis client  redis-tools  or redis-cli=
 +
<pre>
  
[https://www.jianshu.com/p/e0c1fbc98f0d Jenkins自动化部署-数据库篇 (五)]
+
下载 解压源码
 +
sudo make -j 9
 +
sudo cp  src/redis-cli  /usr/bin/redis-cli
 +
</pre>
  
[https://stackoverrun.com/cn/q/11775565 需要在Jenkins管道脚本中执行SQL脚本的工作策略]
 
  
[https://www.zhihu.com/question/61737048 jenkins 进行持续集成的时候,关于SQL执行的问题]
+
=开机自己启动=
 +
<pre>
 +
#非交互
 +
redis_install_dir=/data/apps/redis
 +
echo "${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7004/redis_7004.conf
 +
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7005/redis_7005.conf">${redis_install_dir}/redis_cluster/run
  
[https://www.jianshu.com/p/e0c1fbc98f0d Jenkins自动化部署-数据库篇 (五)]
+
chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
 +
chmod  +x /etc/rc.d/rc.local
 +
echo "${redis_install_dir}/redis_cluster/run"  >>/etc/rc.d/rc.local #把变量替换为值
  
=磁盘处理=
+
#交互
[[Jenkins服务器磁盘空间管理]]
+
vi /apps/redis/redis_cluster/run
  
=trouble shooting=
+
/apps/redis/bin/redis-server /home/apps/redis/redis_cluster/7004/redis_7004.conf
== WeChat.java:[266,43] 找不到符号 ==
+
/apps/redis/bin/redis-server /home/apps/redis/redis_cluster/7005/redis_7005.conf
<pre>
 
[ERROR] /root/.jenkins/workspace/release_read/xtwl_service/src/main/java/org/platform_service/universal/pay/WeChat.java:[266,43] 找不到符号
 
  
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project xtwl_service: Compilation failure
+
chmod  +x  /apps/redis/redis_cluster/run
 +
chmod +x /etc/rc.d/rc.local
  
原来是我用了 clean package -Prelease 之前还替换了配置文件 哈哈 </pre>
+
  vi /etc/rc.d/rc.local
 +
/apps/redis/redis_cluster/run
  
== offline ==
 
点击Continue,大部分人都会出现这个界面,毕竟在天朝,我们先选择跳过
 
  
 +
</pre>
  
==project lxtx-hello-admin-dao: Could not resolve dependencies for project com.lxtx.hello:lxtx ==
+
=开启关闭=
 
<pre>
 
<pre>
Waiting for Jenkins to finish collecting data
+
redis-cli -a xxx -c -h 192.168.0.60 -p 8001 shutdown  #集群cluster_state变成了fail状态?  不过要服务正常的情况下才行
[ERROR] Failed to execute goal on project lxtx-hello-admin-dao: Could not resolve dependencies for project com.lxtx.hello:lxtx-hello-admin-dao:jar:0.0.1: Could not find artifact com.lxtx.im:lxtx-admin-base-service:jar:0.1.6 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
+
 
[ERROR]
 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
 
[ERROR]
 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
 
[ERROR]
 
[ERROR] After correcting the problems, you can resume the build with the command
 
[ERROR]  mvn <goals> -rf :lxtx-hello-admin-dao
 
 
</pre>
 
</pre>
  
=== soult===
+
=troubleshooting=
 
<pre>
 
<pre>
 +
收到报警
  
docker dir
+
Labels
/var/jenkins_home/.m2/settings.xml
+
alertname = vm_host_down
 +
instance = redis://10.3.10.141:7000
 +
job = redis_cluster
  
母鸡目录
+
severity = page
/volumes/docker4jenkins_jenkins_home/_data/.m2/settings.xml
+
Annotations
 +
description = redis://10.3.10.141:7000 of job market_redis_cluster has been down for more than 1 minutes..
 +
summary = Instance redis://10.3.10.141:7000 down
  
<?xml version="1.0" encoding="UTF-8"?>
 
  
<!--
 
Licensed to the Apache Software Foundation (ASF) under one
 
or more contributor license agreements.  See the NOTICE file
 
distributed with this work for additional information
 
regarding copyright ownership.  The ASF licenses this file
 
to you under the Apache License, Version 2.0 (the
 
"License"); you may not use this file except in compliance
 
with the License.  You may obtain a copy of the License at
 
  
    http://www.apache.org/licenses/LICENSE-2.0
+
7000 进程在但是 登录不进去
  
Unless required by applicable law or agreed to in writing,
+
日志如下
software distributed under the License is distributed on an
+
03:01:16.166 # Unable to connect to MASTER: No such file or directory
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+
22283:S 16 Jun 03:01:17.167 * Connecting to MASTER ?:7003
KIND, either express or implied.  See the License for the
+
22283:S 16 Jun 03:01:17.175 # Unable to connect to MASTER: No such file or directory
specific language governing permissions and limitations
+
22283:S 16 Jun 03:01:18.177 * Connecting to MASTER ?:7003
under the License.
 
-->
 
  
<!--
 
| This is the configuration file for Maven. It can be specified at two levels:
 
|
 
|  1. User Level. This settings.xml file provides configuration for a single user,
 
|                and is normally provided in ${user.home}/.m2/settings.xml.
 
|
 
|                NOTE: This location can be overridden with the CLI option:
 
|
 
|                -s /path/to/user/settings.xml
 
|
 
|  2. Global Level. This settings.xml file provides configuration for all Maven
 
|                users on a machine (assuming they're all using the same Maven
 
|                installation). It's normally provided in
 
|                ${maven.home}/conf/settings.xml.
 
|
 
|                NOTE: This location can be overridden with the CLI option:
 
|
 
|                -gs /path/to/global/settings.xml
 
|
 
| The sections in this sample file are intended to give you a running start at
 
| getting the most out of your Maven installation. Where appropriate, the default
 
| values (values used when the setting is not specified) are provided.
 
|
 
|-->
 
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
  <!-- localRepository
 
  | The path to the local repository maven will use to store artifacts.
 
  |
 
  | Default: ${user.home}/.m2/repository
 
    -->
 
  <localRepository>D:\tools\apache-maven-3.3.9-bin\apache-maven-3.3.9\repository</localRepository>
 
  
 +
处理办法 
 +
kill -9 7000的 再启动  暂时正常
  
  <!-- interactiveMode
 
  | This will determine whether maven prompts you when it needs input. If set to false,
 
  | maven will use a sensible default value, perhaps based on some other setting, for
 
  | the parameter in question.
 
  |
 
  | Default: true
 
  <interactiveMode>true</interactiveMode>
 
  -->
 
  
  <!-- offline
 
  | Determines whether maven should attempt to connect to the network when executing a build.
 
  | This will have an effect on artifact downloads, artifact deployment, and others.
 
  |
 
  | Default: false
 
  <offline>false</offline>
 
  -->
 
  
  <!-- pluginGroups
 
  | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
 
  | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
 
  | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
 
  |-->
 
  <pluginGroups>
 
    <!-- pluginGroup
 
    | Specifies a further group identifier to use for plugin lookup.
 
    <pluginGroup>com.your.plugins</pluginGroup>
 
    -->
 
<pluginGroup>org.sonatype.plugins</pluginGroup>
 
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
 
  </pluginGroups>
 
  
  <!-- proxies
 
  | This is a list of proxies which can be used on this machine to connect to the network.
 
  | Unless otherwise specified (by system property or command-line switch), the first proxy
 
  | specification in this list marked as active will be used.
 
  |-->
 
  <proxies>
 
    <!-- proxy
 
    | Specification for one proxy, to be used in connecting to the network.
 
    |
 
    <proxy>
 
      <id>optional</id>
 
      <active>true</active>
 
      <protocol>http</protocol>
 
      <username>proxyuser</username>
 
      <password>proxypass</password>
 
      <host>proxy.host.net</host>
 
      <port>80</port>
 
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
 
    </proxy>
 
    -->
 
  </proxies>
 
  
  <!-- servers
 
  | This is a list of authentication profiles, keyed by the server-id used within the system.
 
  | Authentication profiles can be used whenever maven must make a connection to a remote server.
 
  |-->
 
  <servers>
 
    <!-- server
 
    | Specifies the authentication information to use when connecting to a particular server, identified by
 
    | a unique name within the system (referred to by the 'id' attribute below).
 
    |
 
    | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
 
    |      used together.
 
    | -->
 
    <server>
 
      <id>nexus</id>
 
      <username>admin</username>
 
      <password>lxtxadmin123</password>
 
    </server>
 
 
 
  
    <!-- Another sample, using keys to authenticate.
+
ISCONF Errors writing to the AOF file: No space left on device; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Errors writing to the AOF file: No space left on device
    <server>
 
      <id>siteServer</id>
 
      <privateKey>/path/to/private/key</privateKey>
 
      <passphrase>optional; leave empty if not used.</passphrase>
 
    </server>
 
    -->
 
  </servers>
 
  
  <!-- mirrors
+
org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Errors writing to the AOF file: No space left on device; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Errors writing to the AOF file: No space left on device
  | This is a list of mirrors to be used in downloading artifacts from remote repositories.
 
  |
 
  | It works like this: a POM may declare a repository to use in resolving certain artifacts.
 
  | However, this repository may have problems with heavy traffic at times, so people have mirrored
 
  | it to several places.
 
  |
 
  | That repository definition will have a unique id, so we can create a mirror reference for that
 
  | repository, to be used as an alternate download site. The mirror site will be the preferred
 
  | server for that repository.
 
  |-->
 
  <mirrors>
 
    <!-- mirror
 
    | Specifies a repository mirror site to use instead of a given repository. The repository that
 
    | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
 
    | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
 
    |
 
    <mirror>
 
      <id>mirrorId</id>
 
      <mirrorOf>repositoryId</mirrorOf>
 
      <name>Human Readable Name for this Mirror.</name>
 
      <url>http://my.repository.com/repo/path</url>
 
    </mirror>
 
    -->
 
<!--
 
<mirror>
 
        <id>nexus-aliyun</id>
 
        <mirrorOf>central</mirrorOf>
 
        <name>Nexus aliyun</name>
 
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
 
</mirror>
 
 
<mirror>
 
        <id>nexus-aliyun</id>
 
        <mirrorOf>central</mirrorOf>
 
        <name>Nexus aliyun</name>
 
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
 
</mirror>-->
 
 
<mirror>
 
      <id>nexus</id>
 
      <mirrorOf>*</mirrorOf>
 
      <url>http://192.168.4.189:8081/repository/maven-public/</url>
 
    </mirror>
 
<!--
 
<mirror> 
 
      <id>repo2</id> 
 
      <mirrorOf>central</mirrorOf> 
 
      <name>Human Readable Name for this Mirror.</name> 
 
      <url>http://repo2.maven.org/maven2/</url> 
 
    </mirror>  -->
 
  </mirrors>
 
  
  <!-- profiles
+
原因 有一个台redis的机器 空间100%
  | This is a list of profiles which can be activated in a variety of ways, and which can modify
 
  | the build process. Profiles provided in the settings.xml are intended to provide local machine-
 
  | specific paths and repository locations which allow the build to work in the local environment.
 
  |
 
  | For example, if you have an integration testing plugin - like cactus - that needs to know where
 
  | your Tomcat instance is installed, you can provide a variable here such that the variable is
 
  | dereferenced during the build process to configure the cactus plugin.
 
  |
 
  | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
 
  | section of this document (settings.xml) - will be discussed later. Another way essentially
 
  | relies on the detection of a system property, either matching a particular value for the property,
 
  | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
 
  | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
 
  | Finally, the list of active profiles can be specified directly from the command line.
 
  |
 
  | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
 
  |      repositories, plugin repositories, and free-form properties to be used as configuration
 
  |      variables for plugins in the POM.
 
  |
 
  |-->
 
  <profiles>
 
    <!-- profile
 
    | Specifies a set of introductions to the build process, to be activated using one or more of the
 
    | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
 
    | or the command line, profiles have to have an ID that is unique.
 
    |
 
    | An encouraged best practice for profile identification is to use a consistent naming convention
 
    | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
 
    | This will make it more intuitive to understand what the set of introduced profiles is attempting
 
    | to accomplish, particularly when you only have a list of profile id's for debug.
 
    |
 
    | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
 
    <profile>
 
      <id>jdk-1.4</id>
 
  
      <activation>
 
        <jdk>1.4</jdk>
 
      </activation>
 
  
      <repositories>
 
        <repository>
 
          <id>jdk14</id>
 
          <name>Repository for JDK 1.4 builds</name>
 
          <url>http://www.myhost.com/maven/jdk14</url>
 
          <layout>default</layout>
 
          <snapshotPolicy>always</snapshotPolicy>
 
        </repository>
 
      </repositories>
 
    </profile>
 
    -->
 
  
    <!--
+
tail  boot.log
    | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
+
[  OK  ] Started Network Time Service.
    | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
+
[FAILED] Failed to start /etc/rc.d/rc.local Compatibility.
    | might hypothetically look like:
+
See 'systemctl status rc-local.service' for details.
    |
 
    | ...
 
    | <plugin>
 
    |  <groupId>org.myco.myplugins</groupId>
 
    |  <artifactId>myplugin</artifactId>
 
    |
 
    |  <configuration>
 
    |    <tomcatLocation>${tomcatPath}</tomcatLocation>
 
    |  </configuration>
 
    | </plugin>
 
    | ...
 
    |
 
    | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
 
    |      anything, you could just leave off the <value/> inside the activation-property.
 
    |
 
    <profile>
 
      <id>env-dev</id>
 
  
      <activation>
+
#启动rc-local 服务  on aliyun 不要不小心 不清空了  /etc/rc.d/rc.local
        <property>
+
systemctl enable  rc-local.service
          <name>target-env</name>
 
          <value>dev</value>
 
        </property>
 
      </activation>
 
  
      <properties>
+
redis 安装报错 jemalloc/jemalloc.h: No such file or directory
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
 
      </properties>
 
    </profile>
 
    -->
 
<profile>
 
      <id>nexus</id>
 
      <repositories>
 
        <repository>
 
          <id>central</id>
 
          <url>http://central</url>
 
          <releases><enabled>true</enabled></releases>
 
          <snapshots><enabled>true</enabled></snapshots>
 
        </repository>
 
      </repositories>
 
    <pluginRepositories>
 
        <pluginRepository>
 
          <id>central</id>
 
          <url>http://central</url>
 
          <releases><enabled>true</enabled></releases>
 
          <snapshots><enabled>true</enabled></snapshots>
 
        </pluginRepository>
 
      </pluginRepositories>
 
    </profile>
 
  </profiles>
 
  
  <!-- activeProfiles
+
理上次编译残留文件,重新编译
  | List of profiles that are active for all builds.
 
  |  -->
 
  <activeProfiles>
 
    <activeProfile>nexus</activeProfile>
 
  </activeProfiles>
 
  
</settings>
+
make distclean  && make
</pre>
 
  
==[[Jenkins更多错误]]==
+
导致出现这个错误的原因
  
=进阶=
+
  错误的本质是我们在开始执行make 时遇到了错误(大部分是由于gcc未安装),然后我们安装好了gcc 后,我们再执行make ,这时就出现了jemalloc/jemalloc.h: No such file or directory。这是因为上次的
[https://www.cnblogs.com/shenh/p/8963688.html jenkins + pipeline构建自动化部署]
 
  
  
[https://blog.csdn.net/wh211212/article/details/77482138 Jenkins + Pipeline 构建流水线发布]
+
ERROR: for redis-cluster-8005  Cannot start service redis-cluster-8005: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/home/redis-cluster-docker_host/conf/redis-8005.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/f80340e6f1abc4aa43cde08ba4c5aa48787b092cbbbb64f01c5f0ad213d71368/merged\\\" at \\\"/var/lib/docker/overlay2/f80340e6f1abc4aa43cde08ba4c5aa48787b092cbbbb64f01c5f0ad213d71368/merged/usr/local/etc/redis/redis.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
 +
ERROR: Encountered errors while bringing up the project.
 +
[root@stage-secret-im-rabbitmq03 redis-cluster-docker_host]# docker -V
 +
^C
 +
[root@stage-secret-im-rabbitmq03 redis-cluster-docker_host]# docker -v
 +
Docker version 19.03.5, build 633a0ea
 +
[root@stage-secret-im-rabbitmq03 redis-cluster-docker_host]# docker-compose  down
 +
Removing node-8004 ... done
 +
Removing node-8005 ... done
 +
Removing node-8003 ... done
 +
Removing node-8001 ... done
 +
Removing node-8002 ... done
 +
Removing node-8006 ... done
  
  
[https://www.cnblogs.com/puresoul/p/4828913.html Jenkins内置环境变量的使用]
 
  
https://www.w3cschool.cn/jenkins/jenkins-5h3228n2.html
+
断电后,node文件  nodes-7002.conf 内容中多了一个V 删除后正常
  
=参考=
 
  
[https://jenkins-zh.cn/ Jenkins 中文社区]
+
</pre>
  
[https://www.cnblogs.com/along21/p/9724036.html Jenkins持续集成01—Jenkins服务搭建和部署]
+
== Creating Server TCP listening socket *:6379: bind: No such file or directory==
 +
问题描述
  
[[Jenkins用户手册]]
+
Creating Server TCP listening socket *:6379: bind: No such file or directory
 +
解决思路
  
[https://jenkins.io/doc/book/installing/#docker Installing Docker]
+
我这边检查之后发现Redis服务已经启动了
  
[https://blog.csdn.net/jackyzheng/article/category/6849960 jenkins docs ]
+
    redis-cli 去看是否能连接上,进的去执行 shutdown 就断开连接,重新执行就可以启动 如果可以的话
 +
    ps -ef | grep redis 查看服务是否已经启动,kill -9 PID 杀掉服务重新启动
  
[http://www.cnblogs.com/dcba1112/archive/2011/05/01/2033805.html Maven的安装、配置及使用入门]
+
[https://www.bbsmax.com/A/xl5613k1Jr/ redis 安装报错 jemalloc/jemalloc.h: No such file or directory。]
  
[https://zh.wikipedia.org/wiki/Apache_Maven Apache Maven]
+
==断电后 cluster损坏  ==
 +
<pre>
 +
1:M 31 Aug 2020 02:20:53.960 # Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>
  
[https://zh.wikipedia.org/wiki/Gradle Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化建构工具]
 
  
[https://www.jianshu.com/p/1eff16f60297 Maven 使用教程]
+
</pre>
  
[https://www.jianshu.com/p/60fb231a160e Jenkins学习之自动构建部署maven项目 have emailetc]
+
=Warning: AUTH failed=
  
[https://www.liaoxuefeng.com/article/001463233913442cdb2d1bd1b1b42e3b0b29eb1ba736c5e000 使用Jenkins进行持续集成]
+
<pre>
 +
7002> get evan
 +
-> Redirected to slot [14924] located at 192.168.10.53:7004
 +
Warning: AUTH failed
 +
"36"
  
[http://blog.51cto.com/fluagen/40086 学习maven的使用,看到一篇很实用的入门教程(菜鸟级入门)]
 
  
[http://blog.51cto.com/215687833/1916915 使用Jenkins 自动部署发布]
+
(error) ERR Client sent AUTH, but no password is set
  
[https://www.cnblogs.com/yjmyzz/p/jenkins-tutorial-part-1.html jenkins 入门教程(上)]
+
cli版本太高了
 +
evan@myxps:~$ redis-cli  --version
 +
redis-cli 6.0.6
  
[https://www.cnblogs.com/yjmyzz/p/jenkins-tutorial-part-2.html jenkins 入门教程(中)]
 
  
[https://www.cnblogs.com/yjmyzz/p/jenkins-tutorial-part-3.html jenkins 入门教程(下)]
+
</pre>
 
 
 
 
 
 
[https://blog.csdn.net/true100/article/details/47950215 Android项目利用jinkens自动打包]
 
 
 
[http://blog.51cto.com/linuxg/1792086 Jenkins 持续集成平台构建之使用nexus搭建maven私有仓库]
 
 
 
[https://www.liaoxuefeng.com/article/001463233913442cdb2d1bd1b1b42e3b0b29eb1ba736c5e000 liaoxuefeng使用Jenkins进行持续集成]
 
  
[https://blog.csdn.net/yelllowcong/article/details/78285230 Jenkins之配置Maven和JDK-yellowcong]
+
=see also=
  
[https://www.cnblogs.com/yangxia-test/p/4354328.html Jenkins学习二:Jenkins安装与配置]
 
  
[https://blog.csdn.net/Gred01/article/details/78481606 基于Linux实现Jenkins+maven+git+tomcat的自动化构建部署项目]
+
https://redis.io/topics/cluster-tutorial
  
[https://blog.csdn.net/gbenson/article/details/50970289 Linux平台搭建Jenkins+Maven+Shell实现自动化构建部署]
+
http://redisdoc.com/topic/cluster-tutorial.html
  
==docker==
+
[https://blog.csdn.net/truelove12358/article/details/79612954 Redis cluster集群:原理及搭建]
[https://juejin.im/post/5994d93ef265da24843e416c Jenkins与Docker的持续集成实践]
 
  
[https://www.cnblogs.com/xuezhigu/p/6690783.html 基于Docker构建带有Rsync的Jenkins]
+
[https://blog.csdn.net/yaomingyang/article/details/79057973 (八)Redis集群常用命令、集群节点新增删除]
  
[https://www.cnblogs.com/soar1688/p/6833540.html Jenkins Docker安装及Docker build step插件部署配置]
+
[https://www.cnblogs.com/xmxkkk/p/8038190.html redis集群,添加删除槽]
  
[https://www.kubernetes.org.cn/5230.html 原创:jenkins+github+docker+maven自动化构建部署]
+
[https://blog.51cto.com/kerry/2316700 redis-5.0 cluster带认证及客户端连接]
  
== 权限==
+
[https://www.jianshu.com/p/8045b92fafb2 Redis 5 之后版本的高可用集群搭建]
[https://blog.whsir.com/post-1785.html jenkins权限管理,不同用户显示不同项目]
 
  
[https://www.cnblogs.com/zz0412/p/jenkins_jj_14.html Jenkins进阶系列之——14配置Jenkins用户和权限]
+
[https://blog.csdn.net/zhengzhaoyang122/article/details/94321292 Redis——Cluster集群搭建及节点的添加、删除]
  
[https://www.jianshu.com/p/7e148bcfb96e Jenkins使用教程之用户权限管理(包含插件的安装)]
 
  
[https://blog.csdn.net/itfootball/article/details/71404912 Jenkins用户权限管理]
+
[https://www.cnblogs.com/amei0/p/8177076.html  redis(二)集群 redis-cluster & redis主从同步 ]
  
==maven==
+
[https://blog.csdn.net/duzm200542901104/article/details/83002655  redis cluster查找key的流程]
[https://blog.csdn.net/xlgen157387/article/details/68961371 Jenkins部署Maven多环境项目(dev、beta、prod)的参数设置]
 
  
[http://bookong.iteye.com/blog/2036633 通过Maven和Jenkins插件解决Java项目的配置管理]
 
  
==优化==
+
[https://blog.csdn.net/weixin_40576010/article/details/88418300  主从服务器与集群的区别以及Redis中主从服务器的搭建]
[http://softcook.logdown.com/posts/728344-method-for-reducing-the-jenkins-project-build-disk-space 减少jenkins项目构建磁盘空间的方法]
 
  
[https://blog.csdn.net/ZZY1078689276/article/details/77531325 Jenkins丢弃旧的构建]
+
[https://blog.csdn.net/u010627840/article/details/105089785?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase  redis cluser查看每个主节点管理的slot和从节点]
  
[https://blog.csdn.net/qq_27791709/article/details/78835912 Jenkins-工作区清理插件]
+
[https://blog.csdn.net/u014403825/article/details/84572425 redis 集群查看key在某一个具体的节点上]
  
[[category:ops]]
+
[https://www.cnblogs.com/netonline/p/7875067.html Redis 4集群配置]
 +
[[category:ops]] [[category:redis]]

2020年8月31日 (一) 03:03的版本

优化

remove RDB固化

#dbfilename dump_7000.rdb

pre 常用脚本



 cat  /data/evan/redisloop.sh
#!/bin/bash
#usage  redisloop.sh   rr
cat  $1  | while read line
do

redis-cli    -c  -h    172.31.22.218   -p 7000  -a hell $line
redis-cli    -c  -h    172.31.22.218   -p 7001  -a hell   $line
redis-cli    -c  -h   172.31.16.135   -p 7002  -a hell   $line  
redis-cli    -c  -h   172.31.16.135   -p 7003  -a hell  $line
redis-cli    -c  -h   172.31.23.43   -p 7004  -a hell  $line
redis-cli    -c  -h   172.31.23.43   -p 7005  -a hell   $line
done


vi rr
del hello_coin_limit_045617153_2
del hello_coin_limit_9811460_2





 cat  redisin.sh 
#!/bin/bash
redis-cli    -c  -h    172.31.22.218   -p 7000  -a hello   `cat $1`
redis-cli    -c  -h    172.31.22.218   -p 7001  -a hello   `cat $1`
#
redis-cli    -c  -h   172.31.16.135   -p 7002  -a hello   `cat $1` #$1 # del hello_coin_list 
redis-cli    -c  -h   172.31.16.135   -p 7003  -a hello `cat $1` #$1 #del hello_coin_list 
# 
redis-cli    -c  -h   172.31.23.43   -p 7004  -a hello  `cat $1`#$1 #del hello_coin_list
redis-cli    -c  -h   172.31.23.43   -p 7005  -a hello   `cat $1` #$1 #del hello_coin_list

docker-compose

host 网络 要手工添加集群

同样要用firewall etc 要优化的地方 restart 已添加


相关脚本和配置 https://github.com/evan886/redis/tree/master/redis-cluster-docker_host

Usage:
NOTE2020
docker-compose up -d

#要改的地方
bind   172.18.178.218 127.0.0.1

aliyu 不能 绑定外网NAT IP   bind 内网IP 然后 创建集群用 外网IP就可以了 

不然后
(error) CLUSTERDOWN Hash slot not served  cluster没起来 

#docker exec -it  node-7000  redis-cli -p 7000  --cluster create  10.25.196.78:7000     10.25.196.78:7001  10.25.196.78:7002  10.25.196.78:7003  10.25.196.78:7004  10.25.196.78:7005  --cluster-replicas 1

IP='192.168.10.193'
docker exec -it  node-7000  redis-cli -p 7000  --cluster create  $IP:7000     $IP:7001  $IP:7002  $IP:7003  $IP:7004  $IP:7005  --cluster-replicas 1


# #要改的地方 不要交互
echo 'masterauth passwd123d 
requirepass passwd123d' >>redis-7000.conf




check 

docker exec -it  node-7000  redis-cli -p 7000  -c   -h 483.284.7.34 -a passwd12Trttt3d




bind 要记得改为你要的IP  如果用0.0.0.0 那就不要127.0.0.1 
有问题多看log 目录 

#这里是母机的ip 如果是三台机器 那么就有 三个 IP 
docker exec -it  node-7000  redis-cli -p 7000  --cluster create  ip:7000     ip:7001  ip:7002  ip:7003  ip:7004  ip:7005  --cluster-replicas 1

docker exec -it  node-7000  redis-cli -p 7000  --cluster create --cluster-replicas 1 ip:7000     ip:7001  ip:7002  ip:7003  ip:7004  ip:7005 

三台母机的情形 就是每个docker-compose.yml 只启动两个 ,其它的删除就行了  201912

数据损坏重做 2020

内网的193机器  PHP老是搞坏,或者强行restart os   常常会有几个节点起不来 这时 只能重新做 cluster 

 data 目录下的mv 走或删除掉 
 conf 目录下的 先去掉密码  
 up -d 起所有节点 
 conf 用追加再添加回密码 
 docker-compose restart 起回所有的节点



laradock方法

相关文件


#注意  网络是这个, 还有就是多台机器之间 也不太可能能这个网络 那样 容器之间的redis 是不通的 
NETWORKS_DRIVER=bridge 

less  docker-compose.yml 
### Redis Cluster evan##########################################
    redis-cluster:
      build: ./redis-cluster
      ports:
        - "${REDIS_CLUSTER_PORT_RANGE}:7000-7005"
      networks:
        - backend


cat  redis-cluster/Dockerfile  #注意 redis版本
FROM grokzen/redis-cluster:5.0.6
#FROM grokzen/redis-cluster:latest
LABEL maintainer="hareku <[email protected]>"

添加密码

添加密码 可以进入容器里面直接添加 ,不过不够好 ,有空要 放到母机出来,有如我上面
004  7005  redis-cluster.tmpl	redis.tmpl  sentinel.tmpl
root@401a49002b88:/data# ls /redis-conf/700
7000/ 7001/ 7002/ 7003/ 7004/ 7005/ 
root@401a49002b88:/data# ls /redis-conf/7000/redis.conf 
/redis-conf/7000/redis.conf
root@401a49002b88:/data# tail /redis-conf/7000/redis.conf 
bind 0.0.0.0
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
dir /redis-data/7000


进入redis-cluster 容器 直接非交互  这里以7005 端口为例子 

redis-cli  -c  -h 127.0.0.1  -p 7005   config set masterauth 36DbRGvv66 
redis-cli  -c  -h 127.0.0.1  -p 7005   config set requirepass 36DbRGvv66 
redis-cli  -c  -h 127.0.0.1  -p 7005 auth  36DbRGvv66

redis-cli  -c  -h 127.0.0.1  -p 7005   -a 36DbRGvv66  config rewrite
redis-cli  -c  -h 127.0.0.1  -p 7005  config rewrite  # 最后这一步 有时得 加上密码 



Usage:  可以直接用物理机的ip  内网或者外网 

上次搞了几天 ,是忙晕了 不记得打开防火墙 7000-7005的端口

源码手工

单独安装redis-cli

debian 上可以单独安装 redis-cli 
但是rhel居然不行 只能编译一下  

三步曲后 make  -j  2 之后 ,copy 走这个 bin 文件就行了 
./src/redis-cli -c  /usr/bin/  #或者放 /usr/sbin  只有超级用户可以用到  如果其它用户要用 就不要放这里了 


redis cluster 执行脚本 不用老是一个一个的搞 麻烦   其实只要在三个主上执行就行了 你6个全执行也没事,反正是脚本的 

#!/bin/bash
##Usage  bash redisin.sh   你的redis脚本
redis-cli    -c  -h    172.31.22.218   -p 7000  -a hello   `cat $1`
redis-cli    -c  -h    172.31.22.218   -p 7001  -a hello   `cat $1`
#
redis-cli    -c  -h   172.31.16.135   -p 7002  -a hello   `cat $1` #$1 # del hello_list 


节点信息

角色                        主机名                                                             IP1               IP2       

7000  7001               01                   192.168.10.211     
7002  7003               02                   192.168.10.212      
7004  7005               03                   192.168.10.213      

姐妹篇 Redis4 cluster

防火墙设置

第一台:
firewall-cmd --permanent --add-port=7000/tcp
firewall-cmd --permanent --add-port=17000/tcp
firewall-cmd --permanent --add-port=7001/tcp
firewall-cmd --permanent --add-port=17001/tcp
firewall-cmd --reload
firewall-cmd --list-all-zones
第二台:
firewall-cmd --permanent --add-port=7002/tcp
firewall-cmd --permanent --add-port=17002/tcp
firewall-cmd --permanent --add-port=7003/tcp
firewall-cmd --permanent --add-port=17003/tcp
firewall-cmd --reload
firewall-cmd --list-all-zones
第三台:
firewall-cmd --permanent --add-port=7004/tcp
firewall-cmd --permanent --add-port=17004/tcp
firewall-cmd --permanent --add-port=7005/tcp
firewall-cmd --permanent --add-port=17005/tcp
firewall-cmd --reload
firewall-cmd --list-all-zones

系统参数设置

#vi /etc/sysctl.conf
echo 'vm.overcommit_memory = 1
net.core.somaxconn = 1024' >>/etc/sysctl.conf

/sbin/sysctl -p /etc/sysctl.conf

redis 5 安装

#bash redisins.sh 2>&1 | tee redislog

wget -c http://download.redis.io/releases/redis-5.0.6.tar.gz
#set var
redis_install_dir=/data/apps/redis
redis_ver=5.0.6

THREAD=4
tar xzf redis-${redis_ver}.tar.gz
pushd redis-${redis_ver} > /dev/null

make  -j ${THREAD}

make PREFIX=${redis_install_dir} 
make distclean
#cd src && make install #这个才行 特别是cluster ? 2019年 8月16日 星期五 23时29分41秒 CST
make install  PREFIX=${redis_install_dir}  
echo "export PATH=${redis_install_dir}/bin/:$PATH" >> /etc/profile && source /etc/profile

####**********************下面是老的
wget -c http://download.redis.io/releases/redis-5.0.5.tar.gz
redis_install_dir=/home/apps/redis
redis_ver=5.0.5

THREAD=4
tar xzf redis-${redis_ver}.tar.gz
pushd redis-${redis_ver} > /dev/null
make  -j ${THREAD}
make PREFIX=/home/apps/redis #here
make distclean
#cd src && make install #这个才行 特别是cluster ? 2019年 8月16日 星期五 23时29分41秒 CST
make install  PREFIX=/home/apps/redis  # make install #这个有时没有创建出目录来呀

#这个我没做 根本没用 哈哈 
#复制rb 或者放到安装的bin目录 然后再加path 
#cp /opt/redis-5.0.0/src/redis-trib.rb /usr/local/bin

echo 'export PATH=/home/apps/redis/bin/:$PATH' >> /etc/profile && source /etc/profile
##**********************上面是老的
NOTE
redis5 用redis-cli创建整个redis集群(redis5以前的版本集群是依靠ruby脚本redis-trib.rb实现

创建节点

#第一台:192.168.10.211 #here
redis_install_dir=/data/apps/redis
 mkdir -p ${redis_install_dir}
cd ${redis_install_dir} 
mkdir -p redis_cluster
cd redis_cluster
mkdir data 7000 7001

#cp /root/src/redis-5.0.5/redis.conf  ${redis_install_dir}/redis_cluster
#cd  /home/apps/redis/redis_cluster
#cp redis.conf 7000/redis_7000.conf
#mv redis.conf  7001/redis_7001.conf


#第2台:192.168.10.212
redis_install_dir=/data/apps/redis
mkdir -p ${redis_install_dir}
cd ${redis_install_dir} 
mkdir -p redis_cluster
cd redis_cluster
mkdir data 7002 7003

#cp /root/src/redis-5.0.5/redis.conf  .
#cp  redis.conf 7002/redis_7002.conf
#mv redis.conf  7003/redis_7003.conf


#第3台:192.168.10.213
redis_install_dir=/data/apps/redis
mkdir -p ${redis_install_dir}
cd ${redis_install_dir} 
mkdir -p redis_cluster
cd redis_cluster
mkdir data 7004 7005
#cp /root/src/redis-5.0.5/redis.conf  .
#cp redis.conf 7004/redis_7004.conf
#mv redis.conf 7005/redis_7005.conf


修改配置文件(三台机器6个配置)

note  日志在系统那  因为我们配置文件没指定 /var/log/redis/

ls /home/apps/redis/redis_cluster/data/
appendonly-7000.aof  dump_7000.rdb  nodes_7000.conf
appendonly-7001.aof  dump_7001.rdb  nodes_7001.conf
# 生成在这里了  /home/apps/redis/redis_cluster/data/nodes_7000.conf  nodes_7001.conf

配置建议加上这个  下面这些配置还加上的 
# appendfsync always
appendfsync everysec
# appendfsync no

第一台:
 pushd /home/apps/redis/redis_cluster
mkdir -p /var/log/redis
: > 7000/redis_7000.conf
#vi 7000/redis_7000.conf
#非交互进行
echo 'port 7000
bind 192.168.10.211 127.0.0.1
cluster-enabled yes
appendfilename "appendonly-7000.aof"
cluster-config-file nodes_7000.conf 
cluster-node-timeout 15000
appendonly yes
appendfsync everysec
daemonize yes
dbfilename dump_7000.rdb
dir /data/apps/redis/redis_cluster/data 
logfile "/var/log/redis/7000.log"
protected-mode yes
pidfile /var/run/redis_7000.pid'>7000/redis_7000.conf


:>7001/redis_7001.conf
echo 'port 7001
bind 192.168.10.211 127.0.0.1
cluster-enabled yes
appendfilename "appendonly-7001.aof"
cluster-config-file nodes_7001.conf
cluster-node-timeout 15000
appendonly yes
appendfsync everysec
daemonize yes
dbfilename dump_7001.rdb
dir /home/apps/redis/redis_cluster/data 
logfile "/var/log/redis/7001.log"
protected-mode yes
pidfile /var/run/redis_7001.pid'>7001/redis_7001.conf


第二台 
 pushd /home/apps/redis/redis_cluster
mkdir -p /var/log/redis
:>7002/redis_7002.conf
echo 'port 7002
bind 192.168.10.212 127.0.0.1
cluster-enabled yes
appendfilename "appendonly-7002.aof"
cluster-config-file nodes_7002.conf
cluster-node-timeout 15000
appendonly yes
appendfsync everysec
daemonize yes
dbfilename dump_7002.rdb
dir /home/apps/redis/redis_cluster/data 
logfile "/var/log/redis/7002.log"
protected-mode yes
pidfile /var/run/redis_7002.pid' >7002/redis_7002.conf

:>7003/redis_7003.conf
echo 'port 7003
bind 192.168.10.212 127.0.0.1
cluster-enabled yes
appendfilename "appendonly-7003.aof"
cluster-config-file nodes_7003.conf
cluster-node-timeout 15000
appendonly yes
appendfsync everysec
daemonize yes
dbfilename dump_7003.rdb
dir /home/apps/redis/redis_cluster/data 
logfile "/var/log/redis/7003.log"
protected-mode yes
pidfile /var/run/redis_7003.pid'>7003/redis_7003.conf


第3台
 pushd /home/apps/redis/redis_cluster
mkdir -p /var/log/redis
:>7004/redis_7004.conf
echo 'port 7004
bind 192.168.10.213 127.0.0.1
cluster-enabled yes
appendfilename "appendonly-7004.aof"
cluster-config-file nodes_7004.conf
cluster-node-timeout 15000
appendonly yes
appendfsync everysec
daemonize yes
dbfilename dump_7004.rdb
dir /home/apps/redis/redis_cluster/data 
logfile "/var/log/redis/7004.log"
protected-mode yes
pidfile /var/run/redis_7004.pid ' > 7004/redis_7004.conf

:>7005/redis_7005.conf
echo 'port 7005
bind 192.168.10.213 127.0.0.1
cluster-enabled yes
appendfilename "appendonly-7005.aof"
cluster-config-file nodes_7005.conf
cluster-node-timeout 15000
appendonly yes
daemonize yes
dbfilename dump_7005.rdb
dir /home/apps/redis/redis_cluster/data 
logfile "/var/log/redis/7005.log"
protected-mode yes
pidfile /var/run/redis_7005.pid' >7005/redis_7005.conf

启动redis

#cd /usr/local/redis/etc/redis_cluster #on freebsd
第一台: #注意用 "" 不要'' 要替换变量的值
mkdir /var/log/redis
redis_install_dir=/data/apps/redis
echo  "redis_install_dir=/data/apps/redis
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7000/redis_7000.conf
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7001/redis_7001.conf">${redis_install_dir}/redis_cluster/run

chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
chmod  +x /etc/rc.d/rc.local
echo "${redis_install_dir}/redis_cluster/run" > >/etc/rc.d/rc.local #把变量替换为值,不建议用''

第二台
mkdir /var/log/redis
redis_install_dir=/data/apps/redis
echo "${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7002/redis_7002.conf
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7003/redis_7003.conf">${redis_install_dir}/redis_cluster/run

chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
chmod  +x /etc/rc.d/rc.local
echo "${redis_install_dir}/redis_cluster/run" > >/etc/rc.d/rc.local #把变量替换为值


第三台:
mkdir /var/log/redis
redis_install_dir=/data/apps/redis
echo "${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7004/redis_7004.conf
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7005/redis_7005.conf">${redis_install_dir}/redis_cluster/run

chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
chmod  +x /etc/rc.d/rc.local
echo "${redis_install_dir}/redis_cluster/run"  >>/etc/rc.d/rc.local #把变量替换为值

登陆redis

/home/apps/redis/bin/redis-cli  -c -h  192.168.10.211 -p 7000
redis-cli -h 10.3.10.141 -p 7001

redis-cli -h 10.3.10.142 -p 7002
redis-cli -h 10.3.10.142 -p 7003

redis-cli -h 10.3.10.143 -p 7004
redis-cli -h 10.3.10.143 -p 7005

创建集群

注意:在任意一台上运行 不要在每台机器上都运行,一台就够了
#要开通端口  firewalld
#在geany 有: 格式可能有点不对 要注意 
redis-cli --cluster create --cluster-replicas 1 192.168.10.211:7000 192.168.10.211:7001 192.168.10.212:7002 192.168.10.212:7003 192.168.10.213:7004  192.168.10.213:7005
#--replicas  1  表示 自动为每一个master节点分配一个slave节点    上面有6个节点,程序会按照一定规则生成 3个master(主)3个slave(从)

执行详情

 [root@dev-hello-1 redis_cluster]# redis-cli --cluster create --cluster-replicas 1 192.168.10.201:7000 192.168.10.201:7001 192.168.10.202:7002 192.168.10.202:7003 192.168.10.203:7004  192.168.10.203:7005
>>> 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.10.202:7003 to 192.168.10.201:7000
Adding replica 192.168.10.203:7005 to 192.168.10.202:7002
Adding replica 192.168.10.201:7001 to 192.168.10.203:7004
M: caf3a2c83f4f34498d9152161d3d62ca499094eb 192.168.10.201:7000
   slots:[0-5460] (5461 slots) master
S: ecbc0c648ff15c4ff2c176563afa580c7c8b7f3b 192.168.10.201:7001
   replicates 3792aae886d957e1a0272bcd198a06798f05c26d
M: 9c2f0b7827180d93371b493e8ca59b6eea776b0c 192.168.10.202:7002
   slots:[5461-10922] (5462 slots) master
S: b66f09b38e321ce3f8ee000b7cb40fe804f3a450 192.168.10.202:7003
   replicates caf3a2c83f4f34498d9152161d3d62ca499094eb
M: 3792aae886d957e1a0272bcd198a06798f05c26d 192.168.10.203:7004
   slots:[10923-16383] (5461 slots) master
S: a027592b56eb7477fe039786490318efdda8a0d6 192.168.10.203:7005
   replicates 9c2f0b7827180d93371b493e8ca59b6eea776b0c
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.10.201:7000)
M: caf3a2c83f4f34498d9152161d3d62ca499094eb 192.168.10.201:7000
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: a027592b56eb7477fe039786490318efdda8a0d6 192.168.10.203:7005
   slots: (0 slots) slave
   replicates 9c2f0b7827180d93371b493e8ca59b6eea776b0c
M: 3792aae886d957e1a0272bcd198a06798f05c26d 192.168.10.203:7004
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
M: 9c2f0b7827180d93371b493e8ca59b6eea776b0c 192.168.10.202:7002
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: ecbc0c648ff15c4ff2c176563afa580c7c8b7f3b 192.168.10.201:7001
   slots: (0 slots) slave
   replicates 3792aae886d957e1a0272bcd198a06798f05c26d
S: b66f09b38e321ce3f8ee000b7cb40fe804f3a450 192.168.10.202:7003
   slots: (0 slots) slave
   replicates caf3a2c83f4f34498d9152161d3d62ca499094eb
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

查看redis集群情况

redis-cli -h 192.168.10.211 -p 7000 cluster nodes

a027592b56eb7477fe039786490318efdda8a0d6 192.168.10.203:7005@17005 slave 9c2f0b7827180d93371b493e8ca59b6eea776b0c 0 1567502665000 6 connected
3792aae886d957e1a0272bcd198a06798f05c26d 192.168.10.203:7004@17004 master - 0 1567502666171 5 connected 10923-16383
9c2f0b7827180d93371b493e8ca59b6eea776b0c 192.168.10.202:7002@17002 master - 0 1567502664166 3 connected 5461-10922
ecbc0c648ff15c4ff2c176563afa580c7c8b7f3b 192.168.10.201:7001@17001 slave 3792aae886d957e1a0272bcd198a06798f05c26d 0 1567502664000 5 connected
caf3a2c83f4f34498d9152161d3d62ca499094eb 192.168.10.201:7000@17000 myself,master - 0 1567502663000 1 connected 0-5460
b66f09b38e321ce3f8ee000b7cb40fe804f3a450 192.168.10.202:7003@17003 slave caf3a2c83f4f34498d9152161d3d62ca499094eb 0 1567502665169 4 connected

cluster 完整性检查


redis-trib.rb check 10.3.10.140:7000
redis-trib.rb check 10.3.10.140:7001
redis-trib.rb check 10.3.10.140:7002
redis-trib.rb check 10.3.10.140:7003
redis-trib.rb check 10.3.10.140:7004
redis-trib.rb check 10.3.10.140:7005

结果如下  16384个槽都分配到了 节点 

[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

测试

  
redis-cli -c -h  192.168.10.201 -p 7000

[root@dev-hello-1 redis_cluster]# redis-cli -c -h  192.168.10.201 -p 7000
192.168.10.201:7000> set evan 36
-> Redirected to slot [14924] located at 192.168.10.203:7004
OK
192.168.10.203:7004> 

[root@dev-hello-2 redis_cluster]# redis-cli -c -h  192.168.10.202 -p 7002
192.168.10.202:7002> get evan 
-> Redirected to slot [14924] located at 192.168.10.203:7004
"36"
192.168.10.203:7004> 

dev-hello-3 redis_cluster]#  redis-cli -c -h  192.168.10.203  -p 7005
192.168.10.203:7005> get evan
-> Redirected to slot [14924] located at 192.168.10.203:7004
"36"
192.168.10.203:7004>

测试通过了 




#20191113  
要加 -a 密码访问  不然老是提示要密码
[root@prod-02 ~]# redis-cli  -c -h 172.16.200.12 -p 7002
172.16.200.12:7002> auth ci1723
OK
172.16.200.12:7002> get evan
-> Redirected to slot [14924] located at 172.16.200.7:7004
(error) NOAUTH Authentication required.
172.16.200.7:7004> auth ci1723
OK
172.16.200.7:7004> get evan 
"56;"




添加redis集群密码

方式一:修改所有Redis集群中的redis.conf文件加入

 
#不要交互 
echo 'masterauth passwd123d 
requirepass passwd123d' >>redis-7000.conf



# NOTE   还是这个办法好  不然可能有些 没加载到配置文件去呢 
masterauth passwd123 
requirepass passwd123 
说明:这种方式需要重新启动各节点

方式二:进入各个实例进行设置 就是所有节点:不建议

 
redis-cli -c -h 10.3.10.141 -p 7001
#好像不能一起执行
config set masterauth 36DbRGvv 
config set requirepass 36DbRGvv 
auth  36DbRGvv
config rewrite 

添加redis集群密码 一开始忘记加-c 导致 143 两个都加不上了  redis本身的密码这样就有了

-a 后 再执行命令就再 auth , 而如果是进入后 auth password 要每次 都再验证一下密码 麻烦 

redis client redis-tools or redis-cli


下载 解压源码
sudo make -j 9
sudo cp  src/redis-cli  /usr/bin/redis-cli


开机自己启动

#非交互
redis_install_dir=/data/apps/redis
echo "${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7004/redis_7004.conf
${redis_install_dir}/bin/redis-server ${redis_install_dir}/redis_cluster/7005/redis_7005.conf">${redis_install_dir}/redis_cluster/run

chmod +x ${redis_install_dir}/redis_cluster/run && bash ${redis_install_dir}/redis_cluster/run
chmod  +x /etc/rc.d/rc.local
echo "${redis_install_dir}/redis_cluster/run"  >>/etc/rc.d/rc.local #把变量替换为值

#交互
vi /apps/redis/redis_cluster/run

/apps/redis/bin/redis-server /home/apps/redis/redis_cluster/7004/redis_7004.conf
/apps/redis/bin/redis-server /home/apps/redis/redis_cluster/7005/redis_7005.conf

chmod  +x  /apps/redis/redis_cluster/run
chmod +x /etc/rc.d/rc.local

 vi  /etc/rc.d/rc.local
/apps/redis/redis_cluster/run


开启关闭

redis-cli -a xxx -c -h 192.168.0.60 -p 8001 shutdown  #集群cluster_state变成了fail状态?  不过要服务正常的情况下才行 

troubleshooting

收到报警 

Labels
alertname = vm_host_down
instance = redis://10.3.10.141:7000
job = redis_cluster

severity = page
Annotations
description = redis://10.3.10.141:7000 of job market_redis_cluster has been down for more than 1 minutes..
summary = Instance redis://10.3.10.141:7000 down



 7000 进程在但是 登录不进去 

日志如下 
03:01:16.166 # Unable to connect to MASTER: No such file or directory
22283:S 16 Jun 03:01:17.167 * Connecting to MASTER ?:7003
22283:S 16 Jun 03:01:17.175 # Unable to connect to MASTER: No such file or directory
22283:S 16 Jun 03:01:18.177 * Connecting to MASTER ?:7003


处理办法   
kill -9 7000的 再启动   暂时正常






ISCONF Errors writing to the AOF file: No space left on device; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Errors writing to the AOF file: No space left on device

org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Errors writing to the AOF file: No space left on device; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Errors writing to the AOF file: No space left on device

原因 有一个台redis的机器 空间100% 



tail  boot.log
[  OK  ] Started Network Time Service.
[FAILED] Failed to start /etc/rc.d/rc.local Compatibility.
See 'systemctl status rc-local.service' for details.

#启动rc-local 服务  on aliyun 不要不小心 不清空了  /etc/rc.d/rc.local
 systemctl enable  rc-local.service

redis 安装报错 jemalloc/jemalloc.h: No such file or directory

理上次编译残留文件,重新编译

make distclean  && make

导致出现这个错误的原因

  错误的本质是我们在开始执行make 时遇到了错误(大部分是由于gcc未安装),然后我们安装好了gcc 后,我们再执行make ,这时就出现了jemalloc/jemalloc.h: No such file or directory。这是因为上次的


ERROR: for redis-cluster-8005  Cannot start service redis-cluster-8005: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/home/redis-cluster-docker_host/conf/redis-8005.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/f80340e6f1abc4aa43cde08ba4c5aa48787b092cbbbb64f01c5f0ad213d71368/merged\\\" at \\\"/var/lib/docker/overlay2/f80340e6f1abc4aa43cde08ba4c5aa48787b092cbbbb64f01c5f0ad213d71368/merged/usr/local/etc/redis/redis.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
[root@stage-secret-im-rabbitmq03 redis-cluster-docker_host]# docker -V 
^C
[root@stage-secret-im-rabbitmq03 redis-cluster-docker_host]# docker -v
Docker version 19.03.5, build 633a0ea
[root@stage-secret-im-rabbitmq03 redis-cluster-docker_host]# docker-compose  down 
Removing node-8004 ... done
Removing node-8005 ... done
Removing node-8003 ... done
Removing node-8001 ... done
Removing node-8002 ... done
Removing node-8006 ... done



断电后,node文件  nodes-7002.conf 内容中多了一个V 删除后正常


Creating Server TCP listening socket *:6379: bind: No such file or directory

问题描述

Creating Server TCP listening socket *:6379: bind: No such file or directory 解决思路

我这边检查之后发现Redis服务已经启动了

   redis-cli 去看是否能连接上,进的去执行 shutdown 就断开连接,重新执行就可以启动 如果可以的话 
   ps -ef | grep redis 查看服务是否已经启动,kill -9 PID 杀掉服务重新启动

redis 安装报错 jemalloc/jemalloc.h: No such file or directory。

断电后 cluster损坏

1:M 31 Aug 2020 02:20:53.960 # Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>


Warning: AUTH failed

7002> get evan 
-> Redirected to slot [14924] located at 192.168.10.53:7004
Warning: AUTH failed
"36"


(error) ERR Client sent AUTH, but no password is set

cli版本太高了 
evan@myxps:~$ redis-cli  --version
redis-cli 6.0.6


see also

https://redis.io/topics/cluster-tutorial

http://redisdoc.com/topic/cluster-tutorial.html

Redis cluster集群:原理及搭建

(八)Redis集群常用命令、集群节点新增删除

redis集群,添加删除槽

redis-5.0 cluster带认证及客户端连接

Redis 5 之后版本的高可用集群搭建

Redis——Cluster集群搭建及节点的添加、删除


redis(二)集群 redis-cluster & redis主从同步

redis cluster查找key的流程


主从服务器与集群的区别以及Redis中主从服务器的搭建

redis cluser查看每个主节点管理的slot和从节点

redis 集群查看key在某一个具体的节点上

Redis 4集群配置