一:搭建docker
1.1 部署控制器
curl -SsL -o /tmp/csphere-install.sh https://csphere.cn/static/csphere-install-v2.sh
sudo env ROLE=controller CSPHERE_VERSION=0.13.0 /bin/sh /tmp/csphere-install.sh
1.2 部署Agent
打开浏览器,访问controller A主机的1016端口,第一次访问填入管理员邮箱密码注册,即可看到控制台的界面。 点击左侧的“主机”菜单,进入主机列表页面,点击“添加主机”并复制脚本,在Agent主机安装Agent程序,即可开始希云cSphere旅途。
sudo env ROLE=agent CONTROLLER_IP=192.168.0.126 CONTROLLER_PORT=1016 CSPHERE_VERSION=0.13.0 AUTH_KEY=39ce8737cb161b687616020be27bcbe8d8a44560c935253318e25ccc9ae82ddabca0659b2000584d /bin/sh /tmp/csphere-install.sh
2 添加docker命令
yum install wget
wget -P ~ https://github.com/yeasy/docker\_practice/raw/master/\_local/.bashrc\_docker;
echo "[ -f ~/.bashrc_docker ] && . ~/.bashrc_docker" >> ~/.bashrc; source ~/.bashrc
可执行:
docker-pid 可以获取某个容器的 PID:docker-pid myjenkins
docker-enter 可以进入容器或直接在容器内执行命令:docker-enter myjenkins
二:安装sequenceiq/ambari容器
1、下载镜像
docker pull sequenceiq/ambari
2、下载ambari-functions脚本文件
curl -O https://raw.githubusercontent.com/sequenceiq/docker-ambari/master/ambari-functions
3、执行脚本:ambari-functions
source ambari-functions
4、安装ambari-server和ambari-agent集群:将会启动1个consul server(分布式服务注册和发现consul)、1个Ambari server、2个Ambari agents
amb-start-cluster (安装5个 amb 例:amb-start-cluster 6)
5、创建并启动ambari-shell
Ø 创建ambari-shell容器
docker run -d --name shell --link amb-server:ambariserver hortonworks/ambari-server
Ø 进入ambari-shell容器
docker-enter shell
Ø 创建蓝图文件two-node-only-zookeeper(仅安装zookeeper服务)
vi /tmp/two-node-only-zookeeper
{
"host_groups": [
{
"name": "master",
"components": [
{
"name": "ZOOKEEPER_SERVER"
}
],
"cardinality": "1"
},
{
"name": "slave_1",
"components": [
{
"name": "ZOOKEEPER_CLIENT"
}
],
"cardinality": "1+"
}
],
"Blueprints": {
"blueprint_name": "two-node-only-zookeeper",
"stack_name": "HDP",
"stack_version": "2.5"
}
}
Ø 运行ambari-shell
export AMBARI_HOST=ambariserver;\
export PATH=$PATH:/usr/jdk64/jdk1.7.0_67/bin;\
cd /tmp;\
./ambari-shell.sh
6、通过ambari-shell创建hadoop集群环境
blueprint add --file /tmp/two-node-only-zookeeper
cluster build --blueprint two-node-only-zookeeper
cluster autoAssign
cluster create
7、客户端机器添加网络路由
*Windows(需要以管理员身份运行cmd*): route add 172.17.0.0 mask 255.255.0.0 192.168.0.**62
Linux: route add -net 172.17.0.0/16 192.168.0.207
8、手动安装其他服务
ZooKeeper: ZooKeeper Server、ZooKeeper Client
HDFS: NameNode、SNameNode、DataNode、HDFS Client
YARN + MapReduce2: ResourceManager、History Server、App Timeline Server、
NodeManager、YARN Client、MapReduce2 Client
Tez: Tez Client
Pig: Pig Client
Slider: Slider Client
Hiver: Hive Metastore、HiveServer2、MySQL Server、WebHCat Server、
Hive Client、HCat Client
Spark: Spark History Server、Spark Client
注:如遇到amb容器里无法访问外网 修改SElinux 配置SELINUX=disabled ;
防火墙禁用;