手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

HBase集群安装与部署

[日期:2016-12-19] 来源:Linux社区  作者:learn21cn [字体:大 中 小]

1、相关环境

CentOS7 Hadoop2.6.5 zookeeper3.4.9 jdk1.8 hbase1.2.4

本篇文章仅涉及hbase集群的搭建,关于hadoop与zookeeper的相关部署参见Zookeeper集群的搭建及Hadoop HA的相关配置  http://www.linuxidc.com/Linux/2016-12/138430.htm

目标如下:

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 

Hadoop+HBase搭建云存储总结 PDF http://www.linuxidc.com/Linux/2013-05/83844.htm

Ubuntu Server 14.04 下 Hbase数据库安装  http://www.linuxidc.com/Linux/2016-05/131499.htm

HBase 结点之间时间不一致造成regionserver启动失败 http://www.linuxidc.com/Linux/2013-06/86655.htm

CentOS 6.3下HBase伪分布式平台搭建  http://www.linuxidc.com/Linux/2016-11/136830.htm

Hadoop集群安装&HBase实验环境搭建 http://www.linuxidc.com/Linux/2013-04/83560.htm

基于Hadoop集群的HBase集群的配置 http://www.linuxidc.com/Linux/2013-03/80815.htm‘

Hadoop安装部署笔记之-HBase完全分布模式安装 http://www.linuxidc.com/Linux/2012-12/76947.htm

单机版搭建HBase环境图文教程详解 http://www.linuxidc.com/Linux/2012-10/72959.htm

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

更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2016-12/138536p2.htm

linux
相关资讯       Hbase集群 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款