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/# ===================================================== ...
随机推荐
- C++ virtual inheritance ZZ
虚继承 是面向对象编程中的一种技术,是指一个指定的基类,在继承体系结构中,将其成员数据实例共享给也从这个基类型直接或间接派生的其它类. 举例来说:假如类A和类B各自从类X派生(非虚继承且假设类X ...
- DevExpress之ChartControl实现时间轴实例 z
using System; using System.Data; using System.Windows.Forms; using DevExpress.XtraCharts; namespace ...
- 【Leetcode】【Medium】Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...
- yii2.0 Activeform表单部分组件使用方法 [ 2.0 版本 ]
文本框:textInput(); 密码框:passwordInput(); 单选框:radio(),radioList(); 复选框:checkbox(),checkboxList(); 下拉框:dr ...
- C#图解教程读书笔记(第2章 C#编程概述)
这章主要是一个对于C#程序的概括解释 和C/C++不同,不是用include声明引用的头文件,而是通过using的方式,声明引用的命名空间. 命名和C/C++类似,并且也是区分大小写的,这件事情在VB ...
- LevelDB源码分析之:arena内存管理
一.原理 arena是LevelDB内部实现的内存池. 我们知道,对于一个高性能的服务器端程序来说,内存的使用非常重要.C++提供了new/delete来管理内存的申请和释放,但是对于小对象来说,直接 ...
- ST表学习总结
前段时间做16年多校联合赛的Contest 1的D题(HDU 5726)时候遇到了多次查询指定区间的gcd值的问题,疑惑于用什么样的方式进行处理,最后上网查到了ST表,开始弄得晕头转向,后来才慢慢找到 ...
- App上线流程全攻略(史上最具体步骤)
@转载请保留:iOS界一迷糊小书童--->专注于iOS开发!!谢谢合作 /*****************************************1****************** ...
- thinkphp5.0查询到的数据表中的路径是反斜杠导致无法正常显示图片怎么办?
添加到数据表中图片的路径有时会是反斜杠,这就导致了在url后面写路径的时候会识别不出来(不过src后面写路径就可以识别),所以就需要把路径中的反斜杠替换成正斜杠,代码如下: $datu = Db::q ...
- Linux入门基础介绍
概述: 1. linux是一个开源.免费的操作系统,其稳定性.安全性.处理多并发已经得到业界的认可,目前很多企业级的项目 都会部署到Linux/unix系统上. 2. 常见的操作系统(w ...