hadoop生态搭建(3节点)-14.redis配置
# ==================================================================规划
node1 redis:7000 7001 192.168.6.131
node2 redis:7002 7003 192.168.6.132
node3 redis:7004 7005 192.168.6.133
# ==================================================================安装 redis
yum install -y gcc g++ gcc-c++ make tar -zxvf ~/redis-4.0.10.tar.gz
cd ~/redis-4.0.10 make && make install PREFIX=/usr/local/redis-4.0.10 rm -r ~/redis-4.0.10.tar.gz
# 环境变量
# ==================================================================node1 node2 node3
vi /etc/profile # 在export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL下添加 export JAVA_HOME=/usr/java/jdk1.8.0_111
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.12
export HADOOP_HOME=/usr/local/hadoop-2.7.6
export MYSQL_HOME=/usr/local/mysql
export HBASE_HOME=/usr/local/hbase-1.2.4
export HIVE_HOME=/usr/local/hive-2.1.1
export SCALA_HOME=/usr/local/scala-2.12.4
export KAFKA_HOME=/usr/local/kafka_2.12-0.10.2.1
export FLUME_HOME=/usr/local/flume-1.8.0
export SPARK_HOME=/usr/local/spark-2.3.0
export STORM_HOME=/usr/local/storm-1.1.0
export ERLANG_HOME=/usr/local/erlang
export RABBITMQ_HOME=/usr/local/rabbitmq_server-3.7.5
export MONGODB_HOME=/usr/local/mongodb-3.4.5
export REDIS_HOME=/usr/local/redis-4.0.10
export RUBY_HOME=/usr/local/ruby-2.5.1 export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$ZOOKEEPER_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$MYSQL_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/bin:$SCALA_HOME/bin:$KAFKA_HOME/bin:$FLUME_HOME/bin:$SPARK_HOME/bin:$SPARK_HOME/sbin:$STORM_HOME/bin:$ERLANG_HOME/bin:$RABBITMQ_HOME/ebin:$RABBITMQ_HOME/sbin:$MONGODB_HOME/bin:$REDIS_HOME/bin:$RUBY_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
# ==================================================================node1
# 使环境变量生效
source /etc/profile # 查看配置结果
echo $REDIS_HOME cp /root/redis-4.0.10/redis.conf $REDIS_HOME/redis.conf
# ==================================================================node1
vi $REDIS_HOME/redis.conf # 根据本机所在的IP或hostname
bind node1 # redis后台运行
daemonize yes # pidfile文件
pidfile /usr/local/redis-4.0.10/redis_6379.pid # aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes scp -r $REDIS_HOME node2:/usr/local/
scp -r $REDIS_HOME node3:/usr/local/ mkdir -p $REDIS_HOME/redis_cluster/7000
mkdir -p $REDIS_HOME/redis_cluster/7001 vi $REDIS_HOME/redis_cluster/7000/redis.conf # 端口根据对应的文件夹配置端口 7000,7001,7002,7003,7004,7005
port 7000
# 根据本机所在的IP或hostname配置 node1 node2 node3
bind node1
# redis后台运行
daemonize yes
# pidfile文件对应7000,7001,7002,7003,7004,7005
pidfile /usr/local/redis-4.0.10/redis_cluster/redis_7000.pid
# 开启集群
cluster-enabled yes
# 集群的配置 配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005
cluster-config-file /usr/local/redis-4.0.10/redis_cluster/nodes_7000.conf
# 请求超时 默认15秒,可自行设置
cluster-node-timeout 15000
# aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes vi $REDIS_HOME/redis_cluster/7001/redis.conf # 端口根据对应的文件夹配置端口 7000,7001,7002,7003,7004,7005
port 7001
# 根据本机所在的IP或hostname配置 node1 node2 node3
bind node1
# redis后台运行
daemonize yes
# pidfile文件对应7000,7001,7002,7003,7004,7005
pidfile /usr/local/redis-4.0.10/redis_cluster/redis_7001.pid
# 开启集群
cluster-enabled yes
# 集群的配置 配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005
cluster-config-file /usr/local/redis-4.0.10/redis_cluster/nodes_7001.conf
# 请求超时 默认15秒,可自行设置
cluster-node-timeout 15000
# aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes
# ==================================================================node2 node3
# 使环境变量生效
source /etc/profile # 查看配置结果
echo $REDIS_HOME
# ==================================================================node2
mkdir -p $REDIS_HOME/redis_cluster/7002
mkdir -p $REDIS_HOME/redis_cluster/7003 vi $REDIS_HOME/redis_cluster/7002/redis.conf # 端口根据对应的文件夹配置端口 7000,7001,7002,7003,7004,7005
port 7002
# 根据本机所在的IP或hostname配置 node1 node2 node3
bind node2
# redis后台运行
daemonize yes
# pidfile文件对应7000,7001,7002,7003,7004,7005
pidfile /usr/local/redis-4.0.10/redis_cluster/redis_7002.pid
# 开启集群
cluster-enabled yes
# 集群的配置 配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005
cluster-config-file /usr/local/redis-4.0.10/redis_cluster/nodes_7002.conf
# 请求超时 默认15秒,可自行设置
cluster-node-timeout 15000
# aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes vi $REDIS_HOME/redis_cluster/7003/redis.conf # 端口根据对应的文件夹配置端口 7000,7001,7002,7003,7004,7005
port 7003
# 根据本机所在的IP或hostname配置 node1 node2 node3
bind node2
# redis后台运行
daemonize yes
# pidfile文件对应7000,7001,7002,7003,7004,7005
pidfile /usr/local/redis-4.0.10/redis_cluster/redis_7003.pid
# 开启集群
cluster-enabled yes
# 集群的配置 配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005
cluster-config-file /usr/local/redis-4.0.10/redis_cluster/nodes_7003.conf
# 请求超时 默认15秒,可自行设置
cluster-node-timeout 15000
# aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes
# ==================================================================node3
mkdir -p $REDIS_HOME/redis_cluster/7004
mkdir -p $REDIS_HOME/redis_cluster/7005 vi $REDIS_HOME/redis_cluster/7004/redis.conf # 端口根据对应的文件夹配置端口 7000,7001,7002,7003,7004,7005
port 7004
# 根据本机所在的IP或hostname配置 node1 node2 node3
bind node3
# redis后台运行
daemonize yes
# pidfile文件对应7000,7001,7002,7003,7004,7005
pidfile /usr/local/redis-4.0.10/redis_cluster/redis_7004.pid
# 开启集群
cluster-enabled yes
# 集群的配置 配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005
cluster-config-file /usr/local/redis-4.0.10/redis_cluster/nodes_7004.conf
# 请求超时 默认15秒,可自行设置
cluster-node-timeout 15000
# aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes vi $REDIS_HOME/redis_cluster/7005/redis.conf # 端口根据对应的文件夹配置端口 7000,7001,7002,7003,7004,7005
port 7005
# 根据本机所在的IP或hostname配置 node1 node2 node3
bind node3
# redis后台运行
daemonize yes
# pidfile文件对应7000,7001,7002,7003,7004,7005
pidfile /usr/local/redis-4.0.10/redis_cluster/redis_7005.pid
# 开启集群
cluster-enabled yes
# 集群的配置 配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005
cluster-config-file /usr/local/redis-4.0.10/redis_cluster/nodes_7005.conf
# 请求超时 默认15秒,可自行设置
cluster-node-timeout 15000
# aof日志开启 有需要就开启,它会每次写操作都记录一条日志
appendonly yes
# 开启集群
# ==================================================================node1 node2 node3
# 复制src目录中的redis-trib.rb 到/usr/local/redis/bin目录
cp ~/redis-4.0.10/src/redis-trib.rb $REDIS_HOME/bin scp -r ~/redis-4.0.10/src/redis-trib.rb node2:$REDIS_HOME/bin
scp -r ~/redis-4.0.10/src/redis-trib.rb node3:$REDIS_HOME/bin
# https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz
# https://rubygems.org/pages/download
# https://rubygems.org/gems/redis/versions/4.0.0
# ==================================================================安装 ruby
#yum -y install wget
#wget http://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz tar -zxvf ~/ruby-2.5.1.tar.gz -C /usr/local/
cd /usr/local/ruby-2.5.1
./configure make && make install ln -s $REDIS_HOME/bin/ruby /usr/bin/ruby
ln -s $REDIS_HOME/bin/gem /usr/bin/gem ruby -v cd ~ # 缺少zlib依赖,需要安装zlib库
yum install zlib-devel cd $RUBY_HOME/ext/zlib
ruby extconf.rb vi Makefile top_srcdir =../.. make && make install cd ~ # 缺少openssl库,安装openssl库
yum install openssl-devel cd $RUBY_HOME/ext/openssl
ruby extconf.rb vi Makefile top_srcdir =../.. make && make install cd ~
tar -zxvf ~/rubygems-2.7.7.tgz -C /usr/local/
cd /usr/local/rubygems-2.7.7
ruby setup.rb cd ~
gem install -l redis-4.0.0.gem scp -r ~/ruby-2.5.1.tar.gz node2:~/
scp -r ~/ruby-2.5.1.tar.gz node3:~/ scp -r ~/rubygems-2.7.7.tgz node2:~/
scp -r ~/rubygems-2.7.7.tgz node3:~/ scp -r ~/redis-4.0.0.gem node2:~/
scp -r ~/redis-4.0.0.gem node3:~/ rm -r ~/ruby-2.5.1.tar.gz rm -r ~/rubygems-2.7.7.tgz rm -r ~/redis-4.0.0.gem
# ==================================================================node2 node3
tar -zxvf ~/ruby-2.5.1.tar.gz -C /usr/local/
cd /usr/local/ruby-2.5.1
./configure make && make install ln -s $REDIS_HOME/bin/ruby /usr/bin/ruby
ln -s $REDIS_HOME/bin/gem /usr/bin/gem ruby -v # 缺少zlib依赖,需要安装zlib库
cd ~
yum install zlib-devel cd $RUBY_HOME/ext/zlib
ruby extconf.rb vi Makefile top_srcdir =../.. make && make install # 缺少openssl库,安装openssl库
cd ~
yum install openssl-devel cd $RUBY_HOME/ext/openssl
ruby extconf.rb vi Makefile top_srcdir =../.. make && make install cd ~
tar -zxvf ~/rubygems-2.7.7.tgz -C /usr/local/
cd /usr/local/rubygems-2.7.7
ruby setup.rb cd ~
gem install -l redis-4.0.0.gem rm -r ~/ruby-2.5.1.tar.gz rm -r ~/rubygems-2.7.7.tgz rm -r ~/redis-4.0.0.gem
shutdown -h now
# 快照 redis集群前
# 启动
# ==================================================================node1
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7000/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7001/redis.conf # ==================================================================node2
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7002/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7003/redis.conf # ==================================================================node3
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7004/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7005/redis.conf # 查看进程
ps -ef | grep redis # 查看端口
# netstat -tnlp | grep redis # ==================================================================node1
# $REDIS_HOME/bin/redis-trib.rb create --replicas 1 node1:7000 node1:7001 node2:7002 node2:7003 node3:7004 node3:7005
$REDIS_HOME/bin/redis-trib.rb create --replicas 1 192.168.6.131:7000 192.168.6.131:7001 192.168.6.132:7002 192.168.6.132:7003 192.168.6.133:7004 192.168.6.133:7005 # $REDIS_HOME/bin/redis-trib.rb check node1:7001
$REDIS_HOME/bin/redis-trib.rb check 192.168.6.131:7001 # (-c 制定集群模式,-h 制定ip -p 制定端口号)
# ./redis-cli -c -h -p
# $REDIS_HOME/bin/redis-cli -c -h node1 -p 7001
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7001 # 查看集群信息
cluster info # 查看节点列表
cluster nodes # 关闭集群
# $REDIS_HOME/bin/redis-cli -c -h node1 -p 7001 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7001 shutdown shutdown -h now # 快照 redis集群
# ==================================================================认证
# 启动
# ==================================================================node1
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7000/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7001/redis.conf # ==================================================================node2
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7002/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7003/redis.conf # ==================================================================node3
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7004/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7005/redis.conf # 查看进程
ps -ef | grep redis # 增加认证,是每一个节点的密码必须都一致,如果不一致,切换的时候就会出现没有权限登问题,而且必须登陆进每一个节点设置一次认证才可以。
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7000 > config set masterauth Redis*123456
> config set requirepass Redis*123456
> exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7001 > config set masterauth Redis*123456
> config set requirepass Redis*123456
> exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.132 -p 7002 > config set masterauth Redis*123456
> config set requirepass Redis*123456
> exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.132 -p 7003 > config set masterauth Redis*123456
> config set requirepass Redis*123456
> exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.133 -p 7004 > config set masterauth Redis*123456
> config set requirepass Redis*123456
> exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.133 -p 7005 > config set masterauth Redis*123456
> config set requirepass Redis*123456
> exit # 每个节点(-a Redis*123456 就是刚才所设置的密码,用于认证)
$REDIS_HOME/bin/redis-cli -h 192.168.6.131 -p 7000 -c -a Redis*123456 > config rewrite
> exit $REDIS_HOME/bin/redis-cli -h 192.168.6.131 -p 7001 -c -a Redis*123456 > config rewrite
> exit $REDIS_HOME/bin/redis-cli -h 192.168.6.132 -p 7002 -c -a Redis*123456 > config rewrite
> exit $REDIS_HOME/bin/redis-cli -h 192.168.6.132 -p 7003 -c -a Redis*123456 > config rewrite
> exit $REDIS_HOME/bin/redis-cli -h 192.168.6.133 -p 7004 -c -a Redis*123456 > config rewrite
> exit $REDIS_HOME/bin/redis-cli -h 192.168.6.133 -p 7005 -c -a Redis*123456 > config rewrite
> exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7000 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7001 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.132 -p 7002 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.132 -p 7003 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.133 -p 7004 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.133 -p 7005 -a Redis*123456 shutdown # 再次启动
# ==================================================================node1
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7000/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7001/redis.conf # ==================================================================node2
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7002/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7003/redis.conf # ==================================================================node3
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7004/redis.conf
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis_cluster/7005/redis.conf $REDIS_HOME/bin/redis-cli -h 192.168.6.131 -p 7000 -c -a Redis*123456 #查看所有key
> keys * > set key value > get key > keys * > exit $REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7000 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.131 -p 7001 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.132 -p 7002 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.132 -p 7003 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.133 -p 7004 -a Redis*123456 shutdown
$REDIS_HOME/bin/redis-cli -c -h 192.168.6.133 -p 7005 -a Redis*123456 shutdown shutdown -h now
# 快照 redis集群认证
# ==================================================================单机启动
# 指定配置文件启动 Redis客户端连接指定Redis Server
$REDIS_HOME/bin/redis-server $REDIS_HOME/redis.conf #连接指定Redis Server
$REDIS_HOME/bin/redis-cli -h node1 # 设置:set key1 value1
# 获取:get key1 # 关闭客户端
# $REDIS_HOME/bin/redis-cli -p 6379 shutdown
hadoop生态搭建(3节点)-14.redis配置的更多相关文章
- hadoop生态搭建(3节点)
软件:CentOS-7 VMware12 SSHSecureShellClient shell工具:Xshell 规划 vm网络配置 01.基础配置 02.ssh配置 03.zookeep ...
- 14. Redis配置统计字典
14. Redis配置统计字典14.1 info系统状态说明14.1.1 命令说明14.1.2 详细说明14.2 standalone配置说明和分析14.2.1 总体配置14.2.2 最大内存及策略1 ...
- hadoop生态搭建(3节点)-08.kafka配置
如果之前没有安装jdk和zookeeper,安装了的请直接跳过 # https://www.oracle.com/technetwork/java/javase/downloads/java-arch ...
- hadoop生态搭建(3节点)-15.Nginx_Keepalived_Tomcat配置
# Nginx+Tomcat搭建高可用服务器名称 预装软件 IP地址Nginx服务器 Nginx1 192.168.6.131Nginx服务器 Nginx2 192.168.6.132 # ===== ...
- hadoop生态搭建(3节点)-04.hadoop配置
如果之前没有安装jdk和zookeeper,安装了的请直接跳过 # https://www.oracle.com/technetwork/java/javase/downloads/java-arch ...
- hadoop生态搭建(3节点)-10.spark配置
# https://www.scala-lang.org/download/2.12.4.html# ================================================= ...
- hadoop生态搭建(3节点)-13.mongodb配置
# 13.mongodb配置_副本集_认证授权# ==================================================================安装 mongod ...
- hadoop生态搭建(3节点)-03.zookeeper配置
# https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html # ===== ...
- hadoop生态搭建(3节点)-09.flume配置
# http://archive.apache.org/dist/flume/1.8.0/# ===================================================== ...
随机推荐
- pt-archiver(数据导入导出工具)
数据导入导出工具pt-archiver 工具可以将MySQL的表数据导出到一个新表或者一个文件,也有自己的应用场景,比如数据归档,删除数据,数据合并等. 具体用法: pt-archiver [OPTI ...
- Oracle案例04——ORA-39700: database must be opened with UPGRADE option
Oracle11.2.0.3数据库通过rman备份到Oracle11.2.0.4上做还原,报需要升级的错误,具体处理步骤如下: 一.错误信息 SQL> alter database open r ...
- FQDN说明
以下摘自百度百科: FQDN:(Fully Qualified Domain Name)完全合格域名/全称域名,是指主机名加上全路径,全路径中列出了序列中所有域成员.全域名可以从逻辑上准确地表示出主机 ...
- 设计模式:命令(Command)模式
设计模式:命令(Command)模式 一.前言 命令也是类,将命令作为一个类来保存,当要使用的时候可以直接拿来使用,比如脚本语言写出的脚本,只需要一个命令就能执行得到我们想要的需要操作很长时间才能得到 ...
- EDM邮件群发:群发邮件不进垃圾箱的独家秘笈
EDM邮件群发想要群发的邮件避免进入垃圾箱,不仅需要优化邮件内容和主题,管理收件人邮箱列表,还要有多服务器IP分流技术,控制发信速度,打乱收件人列表等手段,当然更少不了借助专业的邮件群发平台譬如U-M ...
- Dz7.2 从获取uc key到getshell
0x01下午在群里看到的 问下朋友大概 然后用不生不熟的sqlmap在那跑–表能跑的出 列就GG了 然后没辙–晚上跑各大论坛逛了遍果然大神多 就慢慢的研究下了下 看了pt0n大牛的分析文 真心感叹这洞 ...
- [原]如何在Android用FFmpeg+SDL2.0之同步视频
关于视频同步的原理可以参考http://dranger.com/ffmpeg/tutorial05.html 和 [原]基础学习视频解码之同步视频 这两篇文章,本文是在这两篇的基础上移植到了Andro ...
- Ubuntu16.04更换NVIDIA驱动导致无法进入图形界面的解决方案
一.进入recovery模式 由于无法进入图形界面,所以需要在开机时进入恢复模式.我的机器上时在开机时通过引导选项中的recovery mode选项进入,进入之后可以看到许多选项卡,选择root,回车 ...
- vector size函数使用注意事项
vector 的size函数返回vector大小,返回值类型为size_type,Member type size_type is an unsigned integral type,即无符号整数: ...
- jquery 写的图片左右连续滚动
<style type="text/css"> *{ margin:0; padding:0;} body { font:12px/1.8 Arial; color:# ...