構築環境
1.ゲストOSを生成
#Vagrantfileの追加箇所
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.disksize.size = '20GB'
config.vm.provider "virtualbox" do |vm|
vm.memory = 20480
end
config.vm.define "ambr" do |ambr|
ambr.vm.hostname="ambr.example.com"
ambr.vm.network :private_network, ip: "192.168.33.127", auto_config:false
ambr.vm.network :forwarded_port, guest: 22, host: 1127, id: "ssh"
ambr.vm.network :forwarded_port, guest: 8080, host: 8080
end
end
※ 必要に応じて「eth1が見れない時の対処方法」を実施
2.ntp追加
# yum install ntp -y
# chkconfig ntpd on
# service ntpd start
3.鍵の生成(passphraseなし)
$ ssh-keygen -t rsa
$ cd .ssh
$ sudo cp id_rsa /vagrant
$ cat id_rsa.pub >> authorized_keys
4.Ambariインストール
最新のAmbariレポジトリを確認
https://docs.hortonworks.com/
version 2.6.0.0 > 2.6.0.0 (Latest) > Apache Ambari Installation > Installing Ambari > RHEL/CentOS/Oracle Linux 6
Ambariのレポジトリを登録
# wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.6.0.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
有効なリポジトリの一覧を表示
# yum repolist
Ambari Serverをインストール
# yum install ambari-server -y
5.MariaDBのセットアップ
インストールは下記サイトの通り実施
CentOS 6 : MariaDB : インストール : Server World
https://www.server-world.info/query?os=CentOS_6&p=mariadb&f=1
rootパスワード:vagrant
DB作成
# rootpwd=vagrant
# mysqladmin -u root -p$rootpwd create ambaridb
# mysqladmin -u root -p$rootpwd create hivedb
# mysqladmin -u root -p$rootpwd create ooziedb
ユーザ作成
# vi hoge.sql
USE ambaridb;
CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
CREATE USER 'ambari'@'ambr.example.com' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'ambr.example.com';
FLUSH PRIVILEGES;
-- Hive用のユーザも登録
USE hivedb;
CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';
CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
CREATE USER 'hive'@'ambr.example.com' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'ambr.example.com';
FLUSH PRIVILEGES;
-- oozie用のユーザも登録
USE ooziedb;
CREATE USER 'oozie'@'localhost' IDENTIFIED BY 'oozie';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'localhost';
CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';
CREATE USER 'oozie'@'ambr.example.com' IDENTIFIED BY 'oozie';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'ambr.example.com';
FLUSH PRIVILEGES;
# mysql -u root -p$rootpwd < hoge.sql
確認
# mysql -u root -p$rootpwd
> select user,host,password from mysql.user;
MySQL Connector/Jのインストール
# yum install mysql-connector-java -y
6.Ambariのセットアップ
# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)?未入力
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1): 1
To download the Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you must accept the license terms found at http://www.oracle.com/technetwork/java/javase/terms/license/index.html and not accepting will cancel the Ambari Server setup and you must install the JDK and JCE files manually.
Do you accept the Oracle Binary Code License Agreement [y/n] (y)? y
Downloading JDK from http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-8u60-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-8u60-linux-x64.tar.gz
jdk-8u60-linux-x64.tar.gz... 100% (172.8 MB of 172.8 MB)
Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-8u60-linux-x64.tar.gz
Installing JDK to /usr/jdk64/
Successfully installed JDK to /usr/jdk64/
Downloading JCE Policy archive from http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip to /var/lib/ambari-server/resources/jce_policy-8.zip
Successfully downloaded JCE Policy archive to /var/lib/ambari-server/resources/jce_policy-8.zip
Installing JCE policy...
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (1): 3
Hostname (localhost):
Port (3306):
Database name (ambari): ambaridb
Username (ambari): ambari
Enter Database Password (bigdata): ambari
Re-enter password: ambari
Configuring ambari database...
Copying JDBC drivers to server resources...
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
Proceed with configuring remote database connection properties [y/n] (y)?未入力
Extracting system views...
..ambari-admin-2.2.2.0.460.jar
....
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
7.Ambari Serverの起動
Ambari Serverのスキーマを作成
# mysql -u ambari -pambari ambaridb < /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
Ambari Serverの起動
# ambari-server start
Ambari Server 'start' completed successfully.
AmbariとHadoopクラスタがMySQLドライバを使用できることを確認
# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.
# chkconfig --list | egrep 'ambari|mariadb'
ambari-server 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rh-mariadb101-mariadb 0:off 1:off 2:on 3:on 4:on 5:on 6:off