编译并安装 Ambari 2.4.2,编译前的开发环境准备
第1步:下载并构建Ambari 2.4.2源
转到镜像文件地址并找到建议的镜像下载。验证下载的过程描述在下载过程验证
wget http://www.apache.org/dist/ambari/ambari-2.4.2/apache-ambari-2.4.2-src.tar.gz (使用上面建议的镜像)
tar xfvz apache-ambari-2.4.2-src.tar.gz
cd apache-ambari-2.4.2-src
mvn versions:set -DnewVersion=2.4.2.0.0
pushd ambari-metrics
mvn versions:set -DnewVersion=2.4.2.0.0
popd
Note: 如果因为缺少jms,jmxri,jmxtools等工具导致编译ambari-metrics包时产生错误:
[ERROR] Failed to execute goal on project ambari-metrics-kafka-sink: Could not resolve dependencies for project org.apache.ambari:ambari-metrics-kafka-sink:jar:2.2.2-0: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using the available factories WagonRepositoryConnectorFactory
解决方法是手动安装缺少的这三个工具:
mvn install:install-file -Dfile=jms-1.1.pom -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar
mvn install:install-file -Dfile=jmxtools-1.2.1.pom -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar
mvn install:install-file -Dfile=jmxri-1.2.1.pom -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar
这三个工具的pom如下:
$ cat jms-1.1.pom
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<name>Java Message Service</name>
<description>
The Java Message Service (JMS) API is a messaging standard that allows application components based on the Java 2 Platform, Enterprise Edition (J2EE) to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.
</description>
<url>http://java.sun.com/products/jms</url>
<distributionManagement>
<downloadUrl>http://java.sun.com/products/jms/docs.html</downloadUrl>
</distributionManagement>
$ cat jmxri-1.2.1.pom
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
<version>1.2.1</version>
<distributionManagement>
<status>deployed</status>
</distributionManagement>
$ cat jmxtools-1.2.1.pom
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
<version>1.2.1</version>
<distributionManagement>
<status>deployed</status>
</distributionManagement>
RHEL (CentOS 5 or 6) & SUSE (SLES 11):
mvn -B clean install package rpm:rpm -DnewVersion=2.4.2.0.0 -DskipTests -Dpython.ver="python >= 2.6"
Ubuntu/Debian:
mvn -B clean install package jdeb:jdeb -DnewVersion=2.4.2.0.0 -DskipTests -Dpython.ver="python >= 2.6"
Note: 你需要有工具,如rpm-build和brunch等工具。 关先决条件的详细信息,请参阅 Ambari 开发环境.
第2步:安装Ambari服务器
从ambari-server/target/rpm/ambari-server/RPMS/noarch/
安装rmp包
[CentOS 5 or 6]
yum install ambari-server*.rpm #This should also pull in postgres packages as well.
[SUSE(SLES) 11]
zypper install ambari-server*.rpm #This should also pull in postgres packages as well.
[Ubuntu/Debian]
apt-get install ambari-server*.deb #This should also pull in postgres packages as well.
第3步:设置和启动Ambari服务器
运行setup命令配置Ambari服务器,数据库,JDK,LDAP和其他选项:
ambari-server setup
按照屏幕上的说明继续操作。一旦设置完成,启动Ambari服务器:
ambari-server start
第4步:在所有主机上安装和启动Ambari代理
Note: 此步骤需要在将由Ambari管理的所有主机上运行。
从ambari-agent / target / rpm / ambari-agent / RPMS / x86_64 /
中复制rpm软件包并运行:
[CentOS 5 or 6]
yum install ambari-agent*.rpm
[SUSE(SLES) 11]
zypper install ambari-agent*.rpm
[Ubuntu/Debian]
apt-get install ambari-agent*.rpm
编辑 /etc/ambari-agent/ambari.ini
确保[server]下的主机名指向实际的Ambari服务器主机,而不是“localhost”
...
[server]
hostname=localhost
...
ambari-agent start
第5步: 使用Ambari Web UI部署集群
打开Web浏览器并转到http:// <ambari-server-host>:8080
使用admin的用户名和密码登录,并按照屏幕上的说明。尽快确保管理员的详细信息不是默认值从而保护运行环境。
在“安装选项”页面下,输入要添加到群集的主机。不要提供任何SSH密钥,并选中“在主机上执行手动注册,而不使用SSH”,然后单击“下一步”。