修改主机参数
closeSelinux.sh
#! /bin/bash
echo "******** CLOSE SELINUX *********"
setenforce 0
file=/etc/selinux/config
sed -i "7s/^/#/" $file
sed '7 iSELINUX=disabled' -i $file
echo "******** END ********"
closeTHP.sh
#! /bin/bash
echo "******** CLOSE THP *********"
echo "if test -f /sys/kernel/mm/transparent_hugepage/enabled; then" >> /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo "if test -f /sys/kernel/mm/transparent_hugepage/defrag; then" >> /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
echo "******** END ********"
modifyLimits.sh
#! /bin/bash
echo "******** Modify system limits ********"
echo "* soft nofile 65535" >> /etc/security/limits.conf
echo "* hard nofile 65535" >> /etc/security/limits.conf
echo "ocdp - nofile 65535" >> /etc/security/limits.conf
echo "ocdp - nproc 65535" >> /etc/security/limits.conf
echo "******** END ********"
配置hosts文件
setHosts.sh
echo "0.0.0.0 0.0.0.0" >> /etc/hosts;
for i in {001..26};
do
echo "136.192.61.$[10#$i+190-1] pass-eda-hdp-$i" >> /etc/hosts;
done
ssh免密
sshScript.sh
#! /bin/bash
ssh-keygen -t rsa
# 192.168.111 改为集群所在网段(和hosts中配置对应)
ALL_CLIENTS=`cat /etc/hosts| grep "136.192.61" | awk '{print $2}'`
for client in $ALL_CLIENTS
do
echo "=============copy-ssh-id $client============="
ssh-copy-id $client
done
执行
sh init.sh
#install ambari
amabri-setup
#init ambari mysql
mysql -e"use mysql;GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION" -p123456 -h127.0.0.1
mysql -e"CREATE USER ambari IDENTIFIED BY '123456'" -p123456 -h127.0.0.1
mysql -e"CREATE DATABASE ambari" -p123456 -h127.0.0.1
# 执行ambari的sql脚本 路径默认是一样的
mysql -uroot -p123456 -h127.0.0.1 ambari < /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
mysql -e"grant ALL on ambari.* to ambari;flush privileges" -uroot -p123456 -h127.0.0.1
#start ambari
ambari-server start
注意
如果自行使用amabri-setup以下内容可以不管,在初始化mysql完成后 conf/ambari.properties 中配置需要使用sed 命令修改mysql,jdk相关内容。
cat conf/ambari.properties > /etc/ambari-server/conf/ambari.properties
#set amabri mysqlpassword
echo "123456" > /etc/ambari-server/conf/password.dat
版本
当前版本为v0.1,未经过严格测试。
源码
源码已上传github
版权
目前是GUN3,后期趋于完美可能会改为apache2
后续
期望&缺陷
- 加入ntp的安装
- for循环1到26,用该提出来作为配置
- tar 应该使用配置文件管理起来
- mysql部分和amabri setup应该融入脚本 实现从裸机直接到amabri页面安装的一键式脚本