HBase集群安装与部署

1、相关环境

目标如下:

master 192.1.68.1.215 HMaster
data1 192.168.1.218 HMaster备用 HRegionServer
data2 192.168.1.219 HRegionServer

2、关于时间同步的问题

安装hbase,需要服务器之间的时间同步,10秒之内是可接受的范围

1> 安装与配置NTP

每个节点都要安装,以master来作为时间服务器

# 安装NTP
yum install ntp -y 
# 查看NTP状态
service ntpd status
# 配置文件
vim /etc/ntp.conf

以下是配置文件内容

#禁止所有机器来进行连接
restrict default ignore
#允许内网其他机器同步时间
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#配置时间服务器的地址为本机(注视掉server0~server3)
server  127.127.1.0

之后个节点与master进行同步,并设置NTP开机自动启动

# 终端执行命令同步时间         
ntpdate 192.168.1.215
# 设置开机自动启动        
systemctl restart ntpd.service
systemctl enable ntpd.service

以上为最初同步

2> 设置定时任务,使服务器定时同步时间

执行以下命令 :

crontab -e    

 配置文件写入以下内容:

0    1    *    *    *    /usr/sbin/ntpdate    192.168.1.215    >> /data/ntpd.log

保存后执行以下命令查看定时任务,并重启服务

crontab -l
# 重启
systemctl restart crontab.service

3、设置linux系统最大进程数和最大文件打开数

使用root账号

root            soft    nproc           50000
root            hard    nproc           50000
root            soft    nofile          25535
root            hard    nofile          25535
hadoop          soft    nproc           50000
hadoop          hard    nproc           50000
hadoop          soft    nofile          25535
hadoop          hard    nofile          25535

设置完重新登录shell,执行以下命令查看结果

ulimit -a 

4、调整Linux内核参数

打开文件 /etc/sysctl.conf,进行以下设置

net.ipv4.ip_forward= 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 268435456
# 提高系统支持的最大SYN半连接数,表示SYN队列的长度,默认为1024,加大队列长度为,可以容纳最多等待连接的网络连接数
net.ipv4.tcp_max_syn_backlog = 65000
net.core.netdev_max_backlog= 32768
net.core.somaxconn = 32768
fs.file-max = 65000
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_timestamps = 1
# 减少系统SYN连接重试次数(默认是5)
# 为了打开对端的连接,内核需要发送一个SYN并附带一个回应前面一个SYN的ACK,也就是所谓三次握手中的第二次握手。这个设置决定了内核放弃连接之前发送SYN+ACK包的数量。
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
# 以下两参数可解决生产场景中大量连接的Web(cache)服务器中TIME_WAIT过多问题
# 表示开启重用。允许将TIME-WAIT的sockets重新用于新的TCP连接,默认为0表示关闭
net.ipv4.tcp_tw_reuse = 1
# 打开TIME-WAIT套接字重用及回收功能,表示开启TCP连接中TIME-WAIT的sockets的快速收回功能,默认为0表示关闭。
net.ipv4.tcp_tw_recycle = 1
# 当keepalive起用的时候,TCP发送keepalive消息的频度,缺省是2小时,改为1200秒
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies= 1
# 减少处于FIN-WAIT-2连接状态的时间,使系统可以处理更多的连接,缺省值是60秒
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 3
# 允许系统打开的端口范围,表示用于向外连接的端口范围
net.ipv4.ip_local_port_range = 1024 65535
# 网卡eno16777736
net.ipv4.conf.eno16777736.send_redirects = 0
net.ipv4.conf.lo.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
# 网卡eno16777736
net.ipv4.conf.eno16777736.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route= 0
net.ipv4.icmp_ignore_bogus_error_responses = 1
kernel.core_pattern = /tmp/core
vm.overcommit_memory = 1

之后,一定要执行以下命令进行检查,防止出现错误,例如“没有那个文件或目录”之类

# 从指定的文件加载系统参数,如不指定即从/etc/sysctl.conf中加载
sysctl -p

猜你喜欢

转载自www.linuxidc.com/Linux/2016-12/138536.htm
今日推荐