看了很多文章,觉得和实操还是有些出入,就手搭建了一次看看,也算做个备忘
- 配置网络
目前的状态是vmware启用虚拟机,网络选择桥接,已启动成功
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static # 更改项目
ONBOOT=yes # 更改项目
# 新增项目
IPADDR=192.168.124.121、120
NETMASK=255.255.255.0 # 子网掩码
GATEWAY=192.168.124.1
DNS1=114.114.114.114
重启网卡生效即可
service network restart
- 更改主机名&&配置用户
hostnamectl set-hostname master
hostnamectl set-hostname slave
vim /etc/hosts
192.168.124.120 master.pro
192.168.124.121 slave.pro
groupadd hadoop
useradd hadoop -g hadoop
passwd hadoop
chmod 777 /etc/sudoers
vim /etc/sudoers
hadoop ALL=(ALL) NOPASSWD:ALL
chmod 440 /etc/sudoers
- hadoop用户免登陆
su hadoop
ssh-keygen -t rsa
cd ~/.ssh/
ssh-copy-id master (slave)
- 关闭防火墙
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
systemctl status firewalld
- 关闭selinux(需重启才能生效)
sudo sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
- 禁用透明大页面
sudo vim /etc/rc.d/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
sudo chmod +x /etc/rc.d/rc.local
- 修改Linux swappiness(所有节点)
sudo vim /etc/sysctl.conf
vm.swappiness=10
- 安装jdk
sudo cp /opt/CDH/cdh6.3.2/CM安装包/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm /opt/
cd /opt/
sudo rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
find / -name java
sudo vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export PATH=.:$JAVA_HOME/bin:$PATH
source /etc/profile
- ntp 时间同步
– master
sudo yum install -y ntp
sudo vim /etc/ntp.conf
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
#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
sudo vim /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
sudo systemctl restart ntpd.service
sudo systemctl enable ntpd.service
slave
crontab -e
*/10 * * * * /usr/sbin/ntpdate master
- mysql安装
master节点
sudo cp -r /opt/CDH/cdh6.3.2/mysql /opt/
sudo yum remove mysql-libs
sudo yum install libaio
sudo yum -y install autoconf
cd /opt/mysql/
sudo rpm -ivh 01_mysql-community-common-5.7.16-1.el7.x86_64.rpm
sudo rpm -ivh 02_mysql-community-libs-5.7.16-1.el7.x86_64.rpm
sudo rpm -ivh 03_mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
sudo rpm -ivh 04_mysql-community-client-5.7.16-1.el7.x86_64.rpm
sudo rpm -ivh 05_mysql-community-server-5.7.16-1.el7.x86_64.rpm --force --nodeps
sudo systemctl start mysqld
-- 查看密码
sudo cat /var/log/mysqld.log | grep password
mysql -uroot -p'-dQt5l:ed#C!'
set password=password("Fulin@888");
set global validate_password_length=4;
set global validate_password_policy=0;
use mysql
update user set host="%" where user="root";
flush privileges;
- mysql 配置
sudo vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
transaction-isolation = READ-COMMITTED
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
max_connections = 550
log_bin=/var/lib/mysql/mysql_binary_log
server_id=1
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
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/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_ALL_TABLES
service mysqld restart
mysql -uroot -p
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm@123W';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon@123W';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman@123W';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue@123W';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY 'metastore@123W';
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry@123W';
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav@123W';
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms@123W';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie@123W';
flush privileges;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Fulin@888' WITH GRANT OPTION;
FLUSH PRIVILEGES;
- 传JDBC包
sudo mkdir -p /usr/share/java
sudo cp /opt/mysql/mysql-connector-java-5.1.48.jar /usr/share/java
sudo mv /usr/share/java/mysql-connector-java-5.1.48.jar /usr/share/java/mysql-connector-java.jar
sudo sudo scp /usr/share/java/mysql-connector-java.jar slave.pro:/usr/share/java/
- CM 安装
master
sudo mkdir -p /var/www/html/cloudera-repos/cm6/
sudo cp /opt/CDH/cdh6.3.2/CM安装包/* /var/www/html/cloudera-repos/cm6/
sudo yum -y install httpd createrepo
sudo systemctl start httpd && sudo systemctl enable httpd
sudo cd /var/www/html/cloudera-repos/cm6/ && sudo createrepo .
sudo mkdir -p /var/www/html/cloudera-repos/cdh6/
sudo cp -r /opt/CDH/cdh6.3.2/CDH安装包/* /var/www/html/cloudera-repos/cdh6/
sudo cd /var/www/html/cloudera-repos/cdh6/ && sudo createrepo .
-- 构造yum
遇到问题:
没有repo文件
解决办法
到sudo cd /var/www/html/cloudera-repos/cdh6/cm6下面
sudo createrepo --update .
即可出现文件
sudo vi /etc/yum.repos.d/cloudera-repo.repo
[cloudera-repo]
name=cloudera-repo
baseurl=http://192.168.124.120/cloudera-repos/cm6/
enabled=1
gpgcheck=0
sudo yum clean all
sudo yum makecache
- 启动
master 节点
sudo yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
slave 节点
sudo yum install cloudera-manager-daemons cloudera-manager-agent
- 源数据建立
sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm scm@123W
- cm 启动
sudo systemctl start cloudera-scm-server
- 页面操作
看这个
选择存储库
http://192.168.124.120/cloudera-repos/cm6/
更多选项 ----> http://192.168.124.120/cloudera-repos/cdh6/文章来源:https://www.toymoban.com/news/detail-429921.html
提供 SSH 登录凭据
hadoop hadoop[非root用户]
继续即可文章来源地址https://www.toymoban.com/news/detail-429921.html
到了这里,关于从0搭建CDH,非root用户版本的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!