Vous êtes sur la page 1sur 13

Cloudera 6.1.

0 Install

1. Ready 7 Host , 3 for Service/Monitoring , 4 for DataNode (/dfs/dn , /dfs/dn1 ,


/dfs/dn2 , /dfs/dn3 for Datanode volume)
2. Host Basic Config (ALL)
A. Change /etc/profile
HISTSIZE=100000
HISTFILESIZE=1000000000
EDITOR=nano

alias pico='nano'
alias pine='alpine'

source /etc/profile

B. Disable VM Function
virsh net-destroy default
virsh net-undefine default
systemctl restart libvirtd

ifconfig virbr0 down


brctl delbr virbr0
systemctl disable libvirtd
systemctl stop libvirtd
systemctl status libvirtd

C. Disable SELINUX
sed -i 's/=enforcing/=disabled/g' /etc/selinux/config - CentOS6/7

D. Disable Firewall
systemctl disable firewalld ; systemctl stop firewalld ; systemctl status firewalld
chkconfig iptables off ; service iptables stop ; service iptables status

E. Add nano profile


ls /usr/share/nano/
cat ~/.nanorc
find /usr/share/nano/ -iname "*.nanorc" -exec echo include {} \; >> ~/.nanorc
cat ~/.nanorc

F. ADD Commnad logger


pico -w /etc/bashrc
export PROMPT_COMMAND='{ logger -p local6.debug IP:$SSH_CLIENT
pwd=$PWD \# "$(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//g")" ; }'

pico -w /etc/rsyslog.d/bash.conf
$template stiTemplate,"%timegenerated:1:10:date-rfc3339%
%timegenerated:8:15:date-rfc3164% %HOSTNAME% [%syslogtag%]%msg%\n"
local6.* /var/log/Command_history.log;stiTemplate

service rsyslog restart


systemctl restart rsyslog

G. Change /etc/hosts
172.16.92.101 nn01
172.16.92.102 nn02
172.16.92.103 nn03
172.16.92.104 dn01
172.16.92.105 dn02
172.16.92.106 dn03
172.16.92.107 dn04

H. Change shell hostname


hostnamectl set-hostname xxx CentOS7

pico -w /etc/sysconfig/network CentOS6


HOSTNAME=xxxx
NOZEROCONF=yes

hostname xxxx

pico -w /etc/hostname

sed -i "s/^HOSTNAME=.*/HOSTNAME=new_hostname/g"
/etc/sysconfig/network
I. NTP Status Check
chronyc sourcestats
service ntpd status ; ntpq -p

Disable YUM AutoUpdate


sed -i '/ENABLED=/s/true/false/' /etc/sysconfig/yum-autoupdate

virsh net-list ; virsh net-destroy default ; virsh net-list ; virsh net-undefine


default ; service libvirtd stop ; chkconfig libvirtd off
https://www.thegeekdiary.com/how-to-remove-virbr0-and-lxcbr0-interfaces-
on-centos-rhel-5-and-rhel-7/

J. SSH direct
ssh-keygen -t rsa (Direct Enter without any keyin)
ssh-copy-id hostname
( ssh-copy-id -i ~/.ssh/id_rsa.pub hostname )

K. Change SWAP config (減少平時 SWAP 利用)

echo "vm.swappiness = 10" >> /etc/sysctl.conf


sysctl -p

L. Change limit config


pico -w /etc/security/limits.conf
soft nofile 32768
soft nproc 65536
soft memlock unlimited
hard nofile 1046576
hard nproc unlimited
hard memlock unlimited

M. Change /etc/rc.local
pico -w /etc/rc.local
echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
N. Add Java Package and Environment to /etc/profile
alternatives --config java

if above cannot work , try below

update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_55/bin/java


100 ; alternatives --config java
https://blog.csdn.net/zhandoushi1982/article/details/50807282

Cloudera Web 內附的 jdk 無法 使用 alternatives --config java 找到 , 因

此需如下

在/etc/profile 文件中配置 JAVA 环境变量

export JAVA_HOME=/usr/java/jdk1.7.0_55
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

* 自行採用 jdk-8u181-linux-x64.rpm , 取代 Cloudera 官網 JDK to ALL

Node

O. Add MySQL java library


wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-
java-5.1.46.tar.gz
tar zxf mysql-connector-java-5.1.46.tar.gz
cd mysql-connector-java-5.1.46/
cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-
java.jar
scp /usr/share/java/mysql-connector-java.jar root@nn02:/usr/share/java/

P. Install MySQL on Master Server


yum install mysql-server -y (CentOS 6)
yum install mariadb-server -y (CentOS 7)
pico -w /etc/my.cnf (Below for CentOS7 / mariadb)

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
transaction-isolation = READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
symbolic-links = 0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

key_buffer = 16M
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

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 MariaDB, if you enable the binary log and do not set
#a server_id, MariaDB 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
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
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

chkconfig mysqld on ; service mysqld status ; service mysqld start ; service


mysqld status
systemctl enable mariadb ; systemctl start mariadb ; systemctl status mariadb

/usr/bin/mysql_secure_installation

CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '00noilem';

CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE


utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '00noilem';

FLUSH PRIVILEGES;

For CentOS 6 / CDH-5


create database if not exists scm default charset utf8 collate utf8_general_ci;
create database if not exists amon default charset utf8 collate utf8_general_ci;
create database if not exists rman default charset utf8 collate utf8_general_ci;
create database if not exists nav default charset utf8 collate utf8_general_ci;
create database if not exists navms default charset utf8 collate utf8_general_ci;
create database if not exists hue default charset utf8 collate utf8_general_ci;
create database if not exists sentry default charset utf8 collate utf8_general_ci;
create database if not exists hive;
create database if not exists oozie;
grant all on scm.* to 'scm'@'%' identified by 'xxxxxxxx' with grant option;
grant all on hive.* to 'hive'@'%' identified by 'xxxxxxxx' with grant option;
grant all on oozie.* to 'oozie'@'%' identified by 'xxxxxxxx' with grant option;
grant all on hue.* to 'hue'@'%' identified by 'xxxxxxxxx' with grant option;
grant all on amon.* to 'amon'@'%' identified by 'xxxxxxxx' with grant option;
grant all on rman.* to 'rman'@'%' identified by 'xxxxxxxx' with grant option;
grant all on nav.* to 'nav'@'%' identified by 'xxxxxxxxxx' with grant option;
grant all on navms.* to 'navms'@'%' identified by 'xxxxxxxxx' with grant option;
grant all on sentry.* to 'sentry'@'%' identified by 'xxxxxxxxx' with grant option;
flush privileges;

mysql -u scm -p
mysql -u hive -p
mysql -u hue -p
mysql -u rman -p
mysql -u amon -p
mysql -u oozie -p

後面 GUI 安裝時 , 會有 Postgre SQL Error

Starting with CDH 6, PostgreSQL-backed Hue requires the Psycopg2 version to


be at least 2.5.4, see the documentation for more information.
This warning can be ignored if hosts will not run CDH 6, or will not run Hue
with PostgreSQL. The following hosts have an incompatible Psycopg2 version of
'2.5.1':

解决方法:可以忽略 or
yum install python-pip
pip install --upgrade psycopg2

Q. Download Cloudera Source

mkdir /root/soft ; cd ~/soft/ #根据 2.6 约定,所有文件均在此目录下

wget
https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPMS/x86_64/cloudera-
manager-agent-6.1.0-769885.el7.x86_64.rpm
wget
https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPMS/x86_64/cloudera-
manager-daemons-6.1.0-769885.el7.x86_64.rpm
wget
https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPMS/x86_64/cloudera-
manager-server-6.1.0-769885.el7.x86_64.rpm
wget
https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPMS/x86_64/cloudera-
manager-server-db-2-6.1.0-769885.el7.x86_64.rpm
wget
https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPMS/x86_64/oracle-
j2sdk1.8-1.8.0+update141-1.x86_64.rpm

cp agent and daemons Package to ALL node


scp cloudera-manager-daemons-6.1.0-769885.el7.x86_64.rpm root@nn02
scp cloudera-manager-agent-6.1.0-769885.el7.x86_64.rpm root@nn02

Cliudera 5.5.4
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/cloude
ra-manager-agent-5.5.4-1.cm554.p0.14.el6.x86_64.rpm
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/cloude
ra-manager-daemons-5.5.4-1.cm554.p0.14.el6.x86_64.rpm
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/cloude
ra-manager-server-5.5.4-1.cm554.p0.14.el6.x86_64.rpm
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/cloude
ra-manager-server-db-2-5.5.4-1.cm554.p0.14.el6.x86_64.rpm
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/enterp
rise-debuginfo-5.5.4-1.cm554.p0.14.el6.x86_64.rpm
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/jdk-
6u31-linux-amd64.rpm
wget
https://archive.cloudera.com/cm5/redhat/6/x86_64/cm/5.5.4/RPMS/x86_64/oracle-
j2sdk1.7-1.7.0+update67-1.x86_64.rpm

R. Install Package
Manager Server
yum localinstall cloudera-manager-daemons-6.1.0-769885.el7.x86_64.rpm
cloudera-manager-agent-6.1.0-769885.el7.x86_64.rpm cloudera-manager-server-
6.1.0-769885.el7.x86_64.rpm

Other Sever
yum localinstall cloudera-manager-daemons-6.1.0-769885.el7.x86_64.rpm
cloudera-manager-agent-6.1.0-769885.el7.x86_64.rpm

Another method Install rpm without get first

https://www.cloudera.com/documentation/enterprise/latest/topics/poc_run_install
er.html

https://archive.cloudera.com/cm6/6.1.0/cloudera-manager-installer.bin
chmod u+x cloudera-manager-installer.bin
./cloudera-manager-installer.bin <-- rm -rf /etc/cloudera-scm-
server/db.properties if needed

or For clusters without Internet access: Install Cloudera Manager packages


from a local repository:
sudo ./cloudera-manager-installer.bin --skip_repo_package=1
S. Create Mysql SCM (Manager Server Only)
/usr/share/cmf/schema/scm_prepare_database.sh mysql scm scm
(CentOS6/CDH5)
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
(CentOS7/CDH6)

Catch "All done, your SCM database is configured correctly!"

T. Download Cloudera parcel-repo


Cloudera 6.1.0 (Redhat 7)
cd /opt/cloudera/parcel-repo/
wget https://archive.cloudera.com/cdh6/6.1.0/parcels/CDH-6.1.0-
1.cdh6.1.0.p0.770702-el7.parcel
wget https://archive.cloudera.com/cdh6/6.1.0/parcels/CDH-6.1.0-
1.cdh6.1.0.p0.770702-el7.parcel.sha256
wget https://archive.cloudera.com/cdh6/6.1.0/parcels/manifest.json
pico -w manifest.json find CDH-6.1.0-1.cdh6.1.0.p0.770702 SHA
echo "ebe32d2d9c20cb7eab778b81d234f8802591ac97" > CDH-6.1.0-
1.cdh6.1.0.p0.770702-el7.parcel.sha
chown cloudera-scm.cloudera-scm *

Cloudera 5.5.4 (Redhat 6)


wget https://archive.cloudera.com/cdh5/parcels/5.5.4/CDH-5.5.4-
1.cdh5.5.4.p0.9-el6.parcel
wget https://archive.cloudera.com/cdh5/parcels/5.5.4/CDH-5.5.4-
1.cdh5.5.4.p0.9-el6.parcel.sha1
wget https://archive.cloudera.com/cdh5/parcels/5.5.4/manifest.json
cp CDH-5.5.4-1.cdh5.5.4.p0.9-el6.parcel.sha1 CDH-5.5.4-1.cdh5.5.4.p0.9-
el6.parcel.sha
chown cloudera-scm.cloudera-scm *

Manager Install bin (Not nessary)


wget http://archive.cloudera.com/cm5/installer/5.5.4/cloudera-manager-
installer.bin
將 cloudera manager 的用户授權給/opt 和日誌目錄: (Just Check , no

needed)
chown -R cloudera-scm.cloudera-scm /opt/cloudera
chown -R cloudera-scm.cloudera-scm /var/lib/cloudera-scm-server
chown -R cloudera-scm.cloudera-scm /var/log/cloudera-scm-agent

重啟 cloudera-scm-server(重要) to trigger all SCM Service UP

Restart All Server now

U. Start Web install procedure


systemctl status cloudera-scm-server
systemctl status cloudera-scm-agent

service cloudera-scm-server status ; service cloudera-scm-agent status

Login Manager Server http://IP:7180/ admin/admin


tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log

1. License Aggrement
2. Cloudera Enterprise 60 Days test version
3. Install Package List
4. IP Search List : 172.16.92.[100-110] <- Manager self Body ex. 101 will
not marked
5. Use Parcel , Default , CDH Version may need change (CDH-5.5.4-
1.cdh5.5.4.p0.9)
6. JDK install (Ignore this item)
7. Single User Mode (Ignore this item)
8. SSH login (Input root password)
9. Parcel Package install started

10. Checking Server service automated -> Cloudera 支持 Oracle JVM

1.6.0_31 和 1.7.0_55 版本及更高版本

11. Cluster Setting : 所有服务 + Cloudera Navigator


12. Chose Sevice locate
13. Mapping DB
14. Change Data directory /dfs/dn/hdfs + /dfs/dn1/hdfs + /dfs/dn2/hdfs +

/dfs/dn3/hdfs @ first hdfs column {典型值为 /data/N/dfs/dn for N = 1, 2, 3}

mkdir /dfs/dn/data /dfs/dn1/data /dfs/dn2/data /dfs/dn3/data


chown hdfs:hadoop /dfs/dn/data /dfs/dn1/data /dfs/dn2/data
/dfs/dn3/data
ls -l /dfs/dn /dfs/dn1 /dfs/dn2 /dfs/dn3

mkdir -p /data/1/dfs/dn /data/2/dfs/dn /data/3/dfs/dn /data/4/dfs/dn


chown -R hdfs:hdfs /data/1/dfs/nn /nfsmount/dfs/nn /data/1/dfs/dn
/data/2/dfs/dn /data/3/dfs/dn /data/4/dfs/dn

* Directory is not writable -- DiskChecker$DiskErrorException: Directory is


not writable - mount point - rw,noatime,data=ordered
The Hadoop daemons automatically set the correct permissions for you on
dfs.data.dir or dfs.datanode.data.dir. But in the case of dfs.name.dir or
dfs.namenode.name.dir,
permissions are currently incorrectly set to the file-system default, usually
drwxr-xr-x (755). Use the chmod command to reset permissions for these
dfs.name.dir or
dfs.namenode.name.dir directories to drwx------

15. First Start Service


16 . Finish and Congratulations

Vous aimerez peut-être aussi