1.��澧���澶�

CM��CDH����涓�6.3
centos7.4 64浣�

CentOS Linux release 7.4.1708 (Core)

JDK1.8.0_181

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
[root@t3-test-cq-ecs-dtpbu-incubator-01 ansible]# 

5.7.27-log
root�ㄦ�山��瑁�

(1)ansible疏浚�瑁�

yum -y install ansible

#淇��归��缃���浠�
vim /etc/ansible/hosts
[incubator]
incubator--dc-006:53742
incubator--dc-007:53742
incubator--dc-008:53742
incubator--dc-009:53742
incubator--dc-010:53742
incubator--dc-011:53742
incubator--dc-012:53742

ansible incubator -m shell -a "yum -y install rsync"
ansible incubator -m shell -a "yum -y install telnet"
ansible incubator -m shell -a "yum -y install lrzsz"
ansible incubator -m shell -a "yum -y install iptraf"
ansible incubator -m shell -a "yum -y install ntpd"

(2)��缃�hosts

��缇や腑��涓����逛��磋�戒��搁��淇′娇�ㄩ����IP�板����IP�板����涓绘�哄����杩�/etc/hosts��缃�锛�涓绘�哄����杩�/etc/hostname杩�琛���缃���

172.16.16.244 incubator--dc-006
172.16.16.251 incubator--dc-007
172.16.16.252 incubator--dc-008
172.16.16.248 incubator--dc-009
172.16.16.245 incubator--dc-010
172.16.16.243 incubator--dc-011
172.16.16.247 incubator--dc-012

淇�海洋����ц�

ansible incubator -m copy -a "src=/etc/hosts dest=/etc/"

(3)�抽���茬��澧�

"systemctl stop firewalld"
"systemctl disable firewalld"
"systemctl status firewalld"

(4)�抽��setlinux

涓存�朵慨��"setenforce 0"��

��缃���浠朵慨�无边��

��缇ゆ�������逛慨��/etc/selinux/config��浠跺�涓�锛�

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

(5)ssh����root涓�����

sed -i 's#PermitRootLogin no#PermitRootLogin yes#' /etc/ssh/sshd_config
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
systemctl reload sshd

(6)ssh��瀵��诲�

ssh-keygen -t rsa

涓��村��潘����ц���

cat id_rsa.pub  > authorized_keys

�疯� authorized_keys �板�朵��稿�虫�哄�ㄣ��
浣跨��xshell澶�绐��f��浣����戒�娆℃�ф�疯���

echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZq0X+BYWs0OxGDWqO7aZCTJ9YQL1kJB86uAkb6zQT1c+0MoEK0NMfcqiMe0To6JzjpWlHdTHeOgGo2zE+EgK/ofhQCdfNsdmgh4nq+NYMCQ6V4KaaXVC+hwGTTJTOsfgruw29ngbkwwq7nff8QmBTEnpRF4LDQWZOZvUP/Fn5Cp14iGT/t4hiCgQcT/DBI9iQQI3x6nGRKDuutApW0TZIbyipPzDGOBffL7bncjIp8wygj/h2uXKyRpdWTI3iQNjuu7Hbj0Kh1aXLphOHnYYqOl9CgbtvlhX0nwRiarwFxW+mwZeSbgeU40OxMcOrH6V1inWRdihK9360x/RP1z7t root@incubator--dc-012" > /root/.ssh/authorized_keys

ssh -p 53742 root@incubator--dc-011

娉ㄦ��锛��������″�ㄥ�ㄩ�ㄨ��ц�涓�娆°��

(7)ntp��姝ユ�堕��

璁剧疆NTP���$��浣跨�ㄦ���版�堕�磋�琛���姝ャ��

# mv /etc/ntp.conf /etc/ntp.conf.original
# vim /etc/ntp.conf
restrict 172.16.16.0 mask 255.255.255.0 nomodify notrap #�规����宸辩�娈佃�琛�璁剧疆

server 127.127.1.0
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

����ntp���°��

# systemctl start ntpd
# systemctl enable ntpd

NTP疏浚㈡�风����缃�������缃���ntp���$��澶����跺���������无边��

��缃�ntp疏浚㈡�风����

# mv /etc/ntp.conf /etc/ntp.conf.original
# vim /etc/ntp.conf
server 172.16.16.247 #璁剧疆�����扮演��NTP���$��IP�板��

����ntp���°��

# systemctl start ntpd
# systemctl enable ntpd

���ㄥ��姝ユ�堕�淬��

# ntpdate -u 172.16.16.247
21 Aug 16:49:35 ntpdate[2941]: step time server 172.16.16.247 offset -27900.911531 sec

��姝ョ‖浠舵�堕�淬��
# hwclock --systohc --localtime

(8)��浠跺�ユ��淇���

�ㄦ�风骇淇��逛复�剁�����规�锛�������澶辨����ulimit �戒护韬�����潘����跺��纭����讹���-H广大辨��纭����讹���-S广大辨��潘����躲��榛�璁ゆ�剧ず����潘����讹�濡���杩�琛�ulimit �戒护淇��规�舵病����涓�-H��-S锛�广大辨��涓や锅���颁�璧锋�瑰����纭����跺氨��疏浚��������讹���潘����舵��璀������讹�疏浚���浼�缁��鸿������

ulimit -SHn 10000

����
�ㄦ�风骇淇��规案涔������瑰���

vi /etc/security/limits.conf

淇���/etc/security/limits.conf��浠讹�娣诲��濡�涓���疏浚癸�

 * soft nofile 204800  
    * hard nofile 204800

    * soft nproc 204800
    * hard nproc 204800

2.���¤���

2.1.绂��� RHEL7绯诲��Linux��TUNED����

涓�濂��扮演��绯荤�璋�浼�宸ュ�� tuned/tuned-adm锛��朵腑 tuned �����$��绋�搴�锛��ㄦ�ョ���у���堕��绯荤���涓�缁�浠剁���版��锛�骞朵����版����岛���淇℃���ㄦ��璋��寸郴缁�璁剧疆锛�杈惧�板�ㄦ��浼���绯荤���������

纭�淇�tuned���″凡寮��� ��

systemctl start tuned
systemctl status tuned

�抽��tuned����tuned-adm off��
纭�淇�娌℃��宸叉�娲荤����缃�tuned-adm list��
濡���杈��哄��疏浚逛腑����No current active profile琛ㄧず�抽������锛�

�抽��骞朵�绂���tuned���°��
�抽��骞朵�绂���tuned���°��

systemctl stop tuned
systemctl disable tuned

2.2.绂���THP

澶у���Linux骞冲�伴�藉����涓�涓���涓�transparent hugepages�����斤�璇ュ���藉���戒�涓ラ����浣�Hadoop��缇ょ���ц�姐��

娉ㄦ��锛�璇ラ�ㄥ����浣�广大��ㄧ郴缁�������������

妫���THP�������ㄣ��瀵逛�RHEL7绯诲��Linux锛��ョ���规�濡�涓���绀猴�

cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag

杈���[always] never���崇��THP宸插����锛�always [never]���崇��THP������锛�涓��惧氨琛ㄧずTHP宸插����锛�

绂���THP��缂�杈�/etc/rc.d/rc.local��浠讹���涓��㈡房��涓よ���缃�锛�

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

�跺��璧�河渠�/etc/rc.d/rc.local��浠跺���ц�����锛�
chmod +x /etc/rc.d/rc.local

�疯���浠讹�

ansible incubator -m copy -a "src=/etc/rc.d/rc.local   dest=/etc/rc.d/"
ansible incubator -m shell -a "echo never > /sys/kernel/mm/transparent_hugepage/enabled "
ansible incubator -m shell -a "echo never > /sys/kernel/mm/transparent_hugepage/defrag "

2.3. 璋���Linux���稿����

��瑕�璋��寸�����颁负vm.swappiness锛���涓�涓�0-100���硷��ㄤ��у�跺��ㄦ�版��浠��╃����海洋��扮演���涓���������海洋���河渠ゆ��锛��艰�楂�锛�河渠ゆ�㈣�绉���锛��艰�广大�锛�河渠ゆ�㈢��娆℃�拌�广大���

�ョ��褰���璇ラ」���板�硷�
cat /proc/sys/vm/swappiness
2.淇��硅�ラ」���板�硷�涓存�剁����锛�锛�
sysctl -w vm.swappiness=1

缂�杈�/etc/sysctl.conf��浠讹�������姘镐�����锛�锛�娣诲��涓�琛�vm.swappiness=1锛�

2.4��杩�rng-tools���ㄨˉ���垫�

yum -y install rng-tools
echo 'EXTRAOPTIONS="--rng-device /dev/urandom"' > /etc/sysconfig/rngd
systemctl start rngd

3.Cloudera manager疏浚�瑁�

3.1.瑙��插��琛�

172.16.16.244 incubator--dc-006
172.16.16.251 incubator--dc-007
172.16.16.252 incubator--dc-008
172.16.16.248 incubator--dc-009
172.16.16.245 incubator--dc-010
172.16.16.243 incubator--dc-011
172.16.16.247 incubator--dc-012 CM骞冲��

3.2.��寤虹���

httpd绉���疏浚�瑁�疏浚夸富��:172.16.16.247 incubator--dc-012 ���″��

疏浚�瑁�http����
yum -y install httpd  
����httpd���″苟璁剧疆寮��鸿������锛�
systemctl start httpd
systemctl enable httpd

涓�浼�������浠跺����/var/www/html/锛�涓�潘借矾寰�锛�

CM
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-db-2-6.3.0-1281944.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/enterprise-debuginfo-6.3.0-1281944.el7.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPMS/x86_64/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
https://archive.cloudera.com/cm6/6.3.0/allkeys.asc

CDH
https://archive.cloudera.com/cdh6/6.3.0/parcels/CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel
https://archive.cloudera.com/cdh6/6.3.0/parcels/CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha1
https://archive.cloudera.com/cdh6/6.3.0/parcels/CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha256
https://archive.cloudera.com/cdh6/6.3.0/parcels/manifest.json

cm6.3绉��� http://172.16.16.247/cm6.3/

cdh6.3绉��� http://172.16.16.247/cdh6.3/

#��缃�cm-yum婧�
vim /etc/yum.repos.d/cloudera-manager.repo

[cloudera-manager]
name = Cloudera Manager, Version
baseurl = http://172.16.16.247/cm6.3/
gpgcheck = 1
enable = 1

�疯�yum婧��板�朵����″��锛�
ansible incubator -m copy -a "src=/etc/yum.repos.d/cloudera-manager.repo  dest=/etc/yum.repos.d/"

3.3.jdk���″��瑁�

JDK疏浚�瑁���
 ��incubator--dc-012 �哄�ㄤ���缃�bigdata.sh
#set default jdk1.8 env
JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
JRE_HOME=/usr/java/jdk1.8.0_181-cloudera/jre
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME JRE_HOME PATH

��浠舵�疯�锛�
ansible incubator -m copy -a "src=/etc/profile dest=/etc/"
ansible incubator -m copy -a "src=/etc/profile.d/bigdata.sh dest=/etc/profile.d/"
ansible incubator -m copy -a "src=/etc/yum.repos.d/cloudera-manager.repo  dest=/etc/yum.repos.d/"

//�朵��哄�� ssh  -p 53742 root@incubator--dc-011
 ansible incubator -m shell -a "yum -y install  oracle-j2sdk1.8-1.8.0+update181*"
�ц� java ��version

3.4.mysql���″��瑁�

疏浚�瑁�����澶�

wget http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm
rpm -ivh  mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql-community-server

��缃�缂�杈�

vim /etc/my.cnf

[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
validate_password = off # �抽��寮哄����楠�璇�绛���

���ㄦ����

systemctl enable mysqld
systemctl start mysqld
systemctl restart mysqld

�ョ��瀵���

grep 'temporary password' /var/log/mysqld.log

��彭�瀵���: XHtRqLNhl0:7
����

�mysql -uroot -p;
ALTER USER 'root'@'localhost' IDENTIFIED BY '瀵���';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '瀵���'  WITH GRANT OPTION;
FLUSH PRIVILEGES;

3.5.疏浚�瑁�manager-server

yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
��缃�����Parcel海洋��ㄥ�
�疯���浠跺��/opt/cloudera/parcel-repo
�瑰��:

mv CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha1 CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha

�跺���ц�涓��㈢���戒护淇��规��浠舵������锛�

chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/*

3.6.疏浚�瑁�mysqljdbc椹卞��

��缃�mysqljdbc椹卞��
涓�潘藉ソ��mysql-connector-java-5.1.47.tar.gz��涓�瑙e����mysql-connector-java-5.1.47-bin.jar��浠�
ansible incubator -m shell -a "mkdir -pv /usr/share/java"

广大�mysql-connector-java-5.1.47-bin.jar 绉诲�ㄥ��/usr/share/java/涓�
mv mysql-connector-java-5.1.47-bin.jar /usr/share/java/mysql-connector-java.jar

�朵��哄�ㄥ��瑁�锛�
ansible incubator -m copy -a "src=/usr/share/java/mysql-connector-java.jar dest=/usr/share/java/"

3.6.��彭����版��搴�

寤哄�

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 metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

��寤虹�ㄦ�山������

GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm[root瀵���]';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon[root瀵���]';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman[root瀵���]';
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore[root瀵���]';
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive[root瀵���]';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie[root瀵���]';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue[root瀵���]';
FLUSH PRIVILEGES;

�ョ����������姝g‘

SHOW GRANTS FOR�'scm'@'%';

Scm�版��搴���彭���

mysql�版��搴�涓�CM Server涓��ㄥ��涓��颁富�轰�
�ц��戒护锛�

/opt/cloudera/cm/schema/scm_prepare_database.sh mysql   -h incubator--dc-012 -P3306 -uroot ��p[root璐��山����]  --scm-host incubator--dc-012 scm scm [scm瀵���]

3.6.cm server����

systemctl start cloudera-scm-server
systemctl status cloudera-scm-server
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log

//浼����ㄥ��scm寤鸿〃

�跺��绛�寰�Cloudera Manager Server����锛����介��瑕�绋�绛�涓�浼��救救���浠ラ��杩��戒护tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log�荤���ф���″���ㄧ�舵����
褰�����INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.�ュ����板�烘�ュ��锛�璇存�����″���ㄦ����锛���浠ラ��杩�娴�瑙��ㄨ�块��Cloudera Manager WEB����河渠���
http://172.16.16.247:7180

榛�璁よ处�山��瀵����戒负admin锛�

娣诲��涓绘��
incubator--dc-[006-012]
ssh绔��o�53742

��疏浚�涔�搴�
http://172.16.16.247/cm6.3/

JDK��椤�

绉��ラ��缃�

����

疏浚���

4.hadoop缁�浠惰��疏浚�涔�疏浚�瑁�



瑙��插����锛�

5.streamsets������疏浚�瑁�

5.1.streamsets浠�缁�

Streamsets��涓�娆惧ぇ�版��疏浚��堕������ETL宸ュ�凤���浠ュ���颁���涓�琛�浠g��疏浚����版����������娴�潘�����杩����藉�����瑙�������锛�疏浚��版�版��绠¢��(Pipelines)��璁捐�″��疏浚��朵换�¤�搴�����澶х���圭�规��锛�

��瑙������㈡��浣�锛�涓���浠g��疏浚����版����������娴�潘�锛�
��缃����э�����疏浚��舵�ョ���版��娴�浼�杈����烘��淇℃�����版����璐ㄩ��锛�
寮哄ぇ���村����锛�瀵圭�版��甯哥�ㄧ�浠跺�ㄥ������锛�����50绉��版��婧���44绉��版����浣���46绉������般��

瀵逛�Streamsets�ヨ�达�����瑕���姒�蹇靛氨���版��婧�(Origins)����浣�(Processors)��������(Destinations)����寤轰�涓�Pipelines绠¢����缃�涔��烘����杩�涓�涓��归����

甯歌���Origins��Kafka��HTTP��UDP��JDBC��HDFS绛�锛�Processors��浠ュ���板�规��涓�海洋�娈电��杩�婊ゃ���存�无边��缂���������绛���浣�锛�Destinations璺�Origins宸�涓�澶�锛���浠ュ����Kafka��Flume��JDBC��HDFS��Redis绛���

5.2.streamsets疏浚�瑁�

Httpd婧�疏浚�瑁�
yum install -y httpd
service httpd start 

涓�潘�straeamsets.parcel
$ ll
total 5178852
-rw-r--r-- 1 root root       1277 Aug 15 10:35 manifest.json
-rw-r--r-- 1 root root 5303133804 Aug 15 10:36 STREAMSETS_DATACOLLECTOR-3.8.2-el7.parcel

STREAMSETS婧�
mkdir -p /var/www/html/cloudera-repos/streamsets3.8.2
cp STREAMSETS-3.8.2.jar /opt/cloudera/csd/


��������

cloudera-scm-server

Cdh涓�����婵�娲�streamsets
��CM����涓��瑰��Parcel > ��缃� > 娣诲��StreamSets��Parcel��璺�寰�锛�骞朵���淇���
http://172.16.16.247/cloudera-repos/streamsets3.8.2



5.3.CM椤甸�㈠��瑁�streamsets����





5.4.�婚��streamsets����

�ㄦ�山��admin瀵���admin

5.5.疏浚�瑁�椹卞�ㄥ��sdc-extras(姣�涓����戊寅�


��绱�-��缃�-env.sh娣诲��

export STREAMSETS_LIBRARIES_EXTRA_DIR="/opt/cloudera/parcels/STREAMSETS_DATACOLLECTOR/sdc-extras/"
export SDC_JAVA_OPTS="-Xmx5120m -Xms5120m"

��寤虹��褰�淇��规����

mkdir /opt/cloudera/parcels/STREAMSETS_DATACOLLECTOR/sdc-extras/
chown -R sdc:sdc /opt/cloudera/parcels/STREAMSETS_DATACOLLECTOR/sdc-extras/


�� Streamsets 涓���绱� sdc-security.policy锛�娣诲��
grant codebase "file:///opt/cloudera/parcels/STREAMSETS_DATACOLLECTOR/sdc-extras/-" {
permission java.security.AllPermission;
};

6.FAQ

6.1 CM-uuid��璇�

change the UUID in '/var/lib/cloudera-scm-agent/uuid' to the expected value of 94c2c90f-75bf-45fc-9387-6233476772f5, and then restart the Cloudera Manager Agent service.


����锛�
���″�ㄥ己�堕����锛�uuid涓�璇���锛���瑕�淇���uuid涓��风����
骞朵���瑕�echo -n��uuid��锛�����scm��娉�璇���uuid��浠剁���枫��
瑙e�规划�

cd /var/lib/cloudera-scm-agent/
echo -n "13345f3d-0f23-4e8e-b97d-64ee4609db3c" >> uuid
file uuid
����scm-server

6.2Mount point / should not be configured

Mount point / should not be configured for any nameservice as overlapping mount points are not currently supported in HDFS.

瑙e�虫�规�锛�
涓��芥��/��褰�锛�淇��硅��ョ��

6.3Log not rolled. Name node is in safe mode

org.apache.hadoop.hdfs.server.namenode.SafeModeException: Log not rolled. Name node is in safe mode.

瑙e�虫�规�锛�

bash-4.2$ hdfs dfsadmin -safemode enter
Safe mode is ON in incubator-t3-dc-006/172.16.16.244:8020
Safe mode is ON in incubator-t3-dc-007/172.16.16.251:8020
bash-4.2$ hdfs dfsadmin -safemode leave
Safe mode is OFF in incubator-t3-dc-006/172.16.16.244:8020
Safe mode is OFF in incubator-t3-dc-007/172.16.16.251:8020
bash-4.2$ 

6.4�ラ�� Canary 娴�璇���娉��ㄧ��褰�

�ラ�� Canary 娴�璇���娉��ㄧ��褰� /tmp/.cloudera_health_monitoring_canary_files 涓���寤烘��浠躲��

缁�杩��ョ���ュ�锛����� Name node is in safe mode.

瑙e�规划�

sudo -uhdfs hdfs dfsadmin -safemode leave