CDHをインストールする
1.ファイアウォールをオフにする
(1)ファイアウォールをオフにするsystemctl stop firewalld
(2)ファイアウォールの起動を禁止する
systemctl disable firewalld
(3)ファイアウォールの状態を確認する
firewall-cmd --state
次に、ノード名とIPアドレスのマッピングを構成します
(1)ホスト名を設定するvi /etc/hostname
IPアドレス | HostName |
192.168.138.118 | 主人 |
192.168.138.117 | slave01 |
192.168.138.116 | slave02 |
192.168.138.115 | slave03 |
# 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
# ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.138.118 master
192.168.138.117 slave01
192.168.138.116 slave02
192.168.138.115 slave03
3、パスワードなしのSSHログインを構成する
(1)ノードがsshにインストールされているかどうかを確認しますssh localhost
(2)キーを生成する
ssh-keygen -t rsa -P ''
(3)公開鍵を他のノードにコピーする
ssh-copy-id slave01
ssh-copy-id slave02
ssh-copy-id slave03
(4)パスワードなしのログインノードかどうかを確認する
ssh slave01
ssh slave02
ssh slave03
(5)ログアウト
exit
4番目に、SELinuxを構成します。
(1)SELinuxの状態を確認するgetenforce
(2)/ etc / selinux / configファイルを変更します(一部のシステムでは、/ etc / sysconfig / selinuxファイル)
# 修改前
SELINUX=enforcing
# 修改后
SELINUX=disabled
5. NTPサービスを開始します
(1)ノードにNTPがインストールされているかどうかを確認するrpm -qa | grep ntp
(2)NTPを再インストールする
yum -y install ntp
(3)/etc/ntp.confファイルを変更します
マスターノード
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
# restrict <ip address> nomodify notrap nopeer noquery
restrict 192.168.138.118 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# restrict <gateway> mask <prefix> nomodify notrap
restrict 192.168.138.2 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 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
server 127.127.1.0
Fudge 127.127.1.0 stratum 10
#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
slave01ノード
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
# restrict <ip address> nomodify notrap nopeer noquery
restrict 192.168.138.117 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# restrict <gateway> mask <prefix> nomodify notrap
restrict 192.168.138.2 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 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
server 192.168.138.118
Fudge 192.168.138.118 stratum 10
#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
他のノードはSlave01ノードと同じ構成です
(4)NTPサービスを開始します
systemctl start ntpd
(5)NTPサービスを開始する
systemctl enable ntpd
(6)NTPサービスのステータスを表示する
systemctl status ntpd
マスターノード
Slave01ノード
6、jdk1.8をインストール
(1)jdk-8u11-linux-x64.tar.gz圧縮パッケージをダウンロードします(2)jdk-8u11-linux-x64.tar.gz圧縮パッケージを解凍します
tar -zvxf jdk-8u11-linux-x64.tar.gz
(3)jdk1.8.0_11のファイル名を変更する
mv jdk1.8.0_11 jdk1.8
(4)/ etc / profileファイルを変更し、java環境変数を設定します
export JAVA_HOME=/usr/java/jdk1.8
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tool.jar
export PATH=$PATH:$JAVA_HOME/bin
7、httpd配信サーバーを構成する
(1)httpdをインストールするyum -y install httpd
(2)/etc/httpd/conf/httpd.conf構成ファイルを変更します
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /etc/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz .parcel
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
(3)httpdが起動していることを確認します
systemctl enable httpd
(4)httpdサービスを再起動します
systemctl restart httpd
8、Cloudera Managerサーバーをインストールする
(1)Cloudera ManagerとCDHの rpmパッケージを事前にダウンロードするwget https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPMS/x86_64/
wget https://archive.cloudera.com/cdh6/6.1.0/redhat7/yum/RPMS/x86_64/
(2)倉庫を作成する・
createrepo .
(3)cm6.1およびcdh6.1フォルダーを/ var / www / html /フォルダーに移動します。
mv cm6.1 /var/www/html/
mv cdh6.1 /var/www/html/
(4)各マシンは/etc/yum.repos.dの下にCentos7.repoファイルを作成します
[centos7]
name=centos7
baseurl=http://192.168.138.118/cm6.1
enable=true
gpgcheck=false
(5)各マシンはクラウドデータキャッシュを確立します
yum makecache
(6)Cloudera ManagerパッケージをCloudera Managerサーバーホスト(マスターノード)にインストールします
sudo yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
(7)Cloudera Managerパッケージをスレーブノードにインストールします
sudo yum install cloudera-manager-daemons cloudera-manager-agent
(8)/etc/cloudera-scm-agent/config.iniファイルを変更します
# Hostname of the CM server.
server_host=Master
エージェント構成の詳細については、エージェント構成ファイル(9)を参照して
、マスターノードのサーバーおよびエージェントサービスが開始されていることを確認してください。
sudo systemctl enable cloudera-scm-agent
sudo systemctl enable cloudera-scm-server
(10)スレーブノードのエージェントサービスが開始されていることを確認します
sudo systemctl enable cloudera-scm-agent
9、MySQLをインストール
(1)MySQLウェアハウスをダウンロードしてインストールするwget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum install mysql-server
sudo systemctl start mysqld
(2)MySQLサービスの停止
既存のデータベースに変更を加える場合は、続行する前に、データベースを使用するすべてのサービスを停止してください。
sudo systemctl stop mysqld
(3)/etc/my.cnfファイルを変更します
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# To prevent deadlocks
transaction-isolation = READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
symbolic-links = 0
key_buffer_size = 32M
max_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
# Set the max_connections property according to the size of your cluster
max_connections = 550
#expire_logs_days = 10
#max_binlog_size = 100M
#log_bin should be on a disk with enough free space.
#Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your
#system and chown the specified folder to the mysql user.
log_bin=/var/lib/mysql/mysql_binary_log
#In later versions of MySQL, if you enable the binary log and do not set
#a server_id, MySQL will not start. The server_id must be unique within
#the replicating group.
server_id=1
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
# InnoDB settings
# Cloudera Manager will not start if its tables are configured with the MyISAM engine
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 4G
innodb_thread_concurrency = 8
# Cloudera Management Service roles need high write throughput because they might insert many records in the database
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_ALL_TABLES
(4)MySQLサービスが開始されていることを確認します
sudo systemctl enable mysqld
(5)MySQLサービスを開く
sudo systemctl start mysqld
(6)MySQL管理者パスワードとセキュリティ関連の設定を設定します
sudo /usr/bin/mysql_secure_installation
[...]
Enter current password for root (enter for none):
OK, successfully used password, moving on...
[...]
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
[...]
Disallow root login remotely? [Y/n] N
[...]
Remove test database and access to it [Y/n] Y
[...]
Reload privilege tables now? [Y/n] Y
All done!
(7)MySQL JDBCドライバーをダウンロードする
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
(8)mysql-connector-java-5.1.46.tar.gz圧縮パッケージを解凍します
tar zxvf mysql-connector-java-5.1.46.tar.gz
(9)JDBCドライバーを/ usr / share / java /ディレクトリーにコピーします
cd mysql-connector-java-5.1.46
sudo cp mysql-connector-java-5.1.46-bin.jar /opt/cloudera/cm/schema/../lib/mysql-connector-java.jar
(10)MySQLにログインします
mysql -uroot -proot
(11)Clouderaソフトウェアのデータベースを作成する
サービス | データベース | ユーザー |
Cloudera Managerサーバー | scm | scm |
活動モニター | アモン | アモン |
レポートマネージャー | rman | rman |
色相 | 色相 | 色相 |
Hiveメタストアサーバー | メタストア | ハイブ |
セントリーサーバー | 衛兵 | 衛兵 |
Cloudera Navigator監査サーバー | いいえ | いいえ |
Clouderaナビゲーターメタデータサーバー | navms | navms |
Oozie | oozie | oozie |
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
(12)権限を設定する
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '123456';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '123456';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '123456';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '123456';
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY '123456';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '123456';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '123456';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '123456';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '123456';
(13)更新権限
FLUSH PRIVILEGES;
(14)作成したデータベースを確認する
SHOW DATABASES;
(15)ユーザーの権限を確認する
SHOW GRANTS FOR '<user>'@'%';
10、Cloudera Managerデータベースを構成する
sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h master --scm-host master scm scm
11. CDHをインストールする
(1)Cloudera Managerサービスを開始しますsudo systemctl start cloudera-scm-server
(2)Cloudera Managerサーバーログの表示
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log