本次是在win10上的3台虚拟机中安装的。
安装准备
1.设置ip和主机名(也可以不修改主机名,直接用IP,具体修改方法网上搜一下)
master:ip=192.168.6.233 (hostname=master)
tserver: ip=192.168.6.233
ip=192.168.6.232(hostname=tserver1)
ip=192.168.6.231(hostname=tserver2)
2.关闭防火墙或者打开8051和8050端口(master和tserver都执行)
- 关闭防火墙: systemctl stop firewalld.service
- 打开特定端口: firewall-cmd --add-port=8050/tcp --permanent
3.安装依赖,配置kudu的yum源(master和tserver都执行)- CentOS7使用
wget http://archive.cloudera.com/kudu/redhat/7/x86_64/kudu/cloudera-kudu.repo
4.配置NTP服务
#安装ntp(master和tserver)
yum -y install ntp
#修改配置文件(master)
vim /etc/ntp.conf
restrict 127.0.0.1
restrict ::1
改为
restrict 127.0.0.1
restrict ::1
restrict 192.168.6.0 mask 255.255.255.0 notrap nomodify # 给192.168.6.0网段,子网掩码为255.255.255.0的局域网机的机器有同步时间的权限
server 192.168.6.233 prefer # prefer代表优先使用此ip做同步
server 127.127.1.0 # 当所有服务器都不能使用时,使用本机作为同步服务器
fudge 127.127.1.0 stratum 10
#修改配置文件(tserver)
vim /etc/ntp.conf
restrict 127.0.0.1
restrict ::1
改为
restrict 127.0.0.1
restrict ::1
server 192.168.6.233 prefer
server 127.127.1.0
fudge 127.127.1.0 stratum 10
#注释掉以下四行(master和tserver)
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#启动(master和tserver)
service ntpd start
chkconfig ntpd on
- 检查ntp服务是否成功输入:ntpstat (同步时间可能有点久)
#表示成功
synchronised to local net at stratum 11
time correct to within 7948 ms
polling server every 64 s
5.下载kudu并配置
下载并安装
#因为我的233机器是master也是tserver,所以执行
yum install kudu kudu-master kudu-tserver kudu-client0 kudu-client-devel -y
#master安装
yum install kudu kudu-master kudu-client0 kudu-client-devel -y
#tserver安装
yum install kudu kudu-tserver kudu-client0 kudu-client-devel -y
- 修改配置文件(master)
#修改vim /etc/default/kudu-master
export FLAGS_log_dir=/var/log/kudu
export FLAGS_rpc_bind_addresses=master:7051
- 修改配置文件(tserver)
#修改vim /etc/kudu/conf.dist/tserver.gflagfile
# Do not modify these two lines. If you wish to change these variables,
# modify them in /etc/default/kudu-tserver.
--fromenv=rpc_bind_addresses
--fromenv=log_dir
--fs_wal_dir=/var/lib/kudu/tserver
--fs_data_dirs=/var/lib/kudu/tserver
--tserver_master_addrs=master:7051 # 指定master(集群)
#修改vim /etc/default/kudu-tserver
#233修改为(因为233又做master又做tserver,所以有这一步,如果服务器只是做master,不需要执行这一步)
export FLAGS_log_dir=/var/log/kudu
export FLAGS_rpc_bind_addresses=master:7050 #本机的IP地址或者本机的hostname
#231修改为
export FLAGS_log_dir=/var/log/kudu
export FLAGS_rpc_bind_addresses=tserver2:7050 #本机的IP地址或者本机的hostname
#232修改为
export FLAGS_log_dir=/var/log/kudu
export FLAGS_rpc_bind_addresses=tserver1:7050 #本机的IP地址或者本机的hostname
6.启动kudu
- master节点(192.168.6.233)执行
service kudu-master start
service kudu-tserver start
- tserver节点执行
service kudu-tserver start
7.效果
启动报错:
1.错误代码:
Failed to initialize sys tables async: Could not load tablet metadata from /var/lib/kudu/master/tablet-meta/00000000000000000000000000000000:
解决办法:删除/var/lib/kudu/master/tablet-meta 文件夹重新启动master
2.错误代码
master_main.cc:68] Check failed: _s.ok() Bad status:Service unavailable: Cannot initialize clock: Error reading clock. Clock considered
解决办法:检查是否有安装ntp,同步时间是否正确,详情跳转第四点。
3.错误代码
IO error: Could not create new FS layout: unable to create file system roots: unable to
write instance metadata
解决办法:由于kudu的权限引起的。如果换了日志打印路径和配置文件路径。需要修改文件和文件夹的权限
例如:没有kudu权限的文件夹为:/var/lib/kudu
执行代码:
chown -R kudu:kudu /var/lib/kudu