概述
Centos7.6安装CDH6.3
文章目录
- Centos7.6安装CDH6.3
- 1、下载安装包
- 2、集群环境准备
- 3、安装mysql
- 4、配置yum parcel源
- 一般为/etc/my.cnf
1、下载安装包
Cloudera Manager安装包 下载
cm6.3.0-redhat7.tar.gz
CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel
CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha1
manifest.json
cloudera-manager-installer.bin
安装包下载后上传到主节点,然后再scp
下载期间可以进行其他配置,比如配置ssh免密登录
2、集群环境准备
-
配置节点IP地址
vim /etc/sysconfig/network-scripts/ifcfg-eth33 # 内容如下: DEVICE=eth0 HWADDR=00:50:56:93:24:7E TYPE=Ethernet UUID=8ca9d801-a91a-4365-8b08-d54c6c3050d0 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=192.168.0.100 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 DNS1=202.96.209.5 DNS2=202.96.209.133 # ONBOOT:IP开机自动启动 # BOOTPROTO:IP类型为静态IP # IPADDR:IP地址 # NETMASK:子网掩码 # GATEWAY:默认网关 # DNS1,DNS2:DNS服务器(联网用的)
-
做好免密登录,在主节点执行ssh-keygen 将生成的公钥拷贝到其他节点的
/root/.ssh/authorized_keys
文件中。或者直接使用ssh-copy-id然后输入密码,让机器自动拷贝公钥 -
配置hosts映射
# 修改/etc/hosts文件,添加映射关系 132.46.112.78 p01 132.46.112.79 p02 132.46.112.80 p03 132.46.112.81 p04 132.46.112.82 p05 132.46.112.83 p06 132.46.112.84 p07 132.46.112.85 p08 132.46.112.86 p09 132.46.112.87 p10 132.46.112.88 p11 132.46.112.89 p12 132.46.112.90 p13 132.46.112.91 p14 132.46.112.92 p15 132.46.112.93 p16 132.46.112.94 p17 132.46.112.95 p18 132.46.112.96 p19 132.46.112.97 p20
配置好了之后将该文件分别scp到其他节点上面比如:
scp /etc/hosts p02:/etc/
-
关闭防火墙。集群之间的免密登录配置好了之后可以使用脚本执行
#关闭防火墙 ssh p01 'systemctl stop firewalld.service' ssh p02 'systemctl stop firewalld.service' ## 省略其他节点的命令 ssh p20 'systemctl stop firewalld.service' # 禁止防火墙开机自启 ssh p01 'systemctl disable firewalld.service' ssh p02 'systemctl disable firewalld.service' ## 省略其他节点的命令 ssh p20 'systemctl disable firewalld.service'
执行之后使用
firewall-cmd --state
命令查看一下,确保执行成功 -
禁用Selinux
重启机器才会生效,这里先不重启vim /etc/sysconfig/selinux ## 修改配置项: SELINUX=disabled
-
卸载自带JDK
-
设置最大文件打开数据和用户最大进程数
## 设置用户最大进程数 vim /etc/security/limits.conf ## 结尾添加以下内容 * soft nofile 32768 * hard nofile 1048576 * soft nproc 65536 * hard nproc unlimited * soft memlock unlimited * hard memlock unlimited
-
安装ntpd时间同步服务
-
关闭透明页(非必需,属于优化选项)
在/etc/rc.local文件中加入: #echo never > /sys/kernel/mm/transparent_hugepage/defrag #echo never > /sys/kernel/mm/transparent_hugepage/enabled echo ' ' >> /etc/rc.local echo '# 关闭大透明页面' >> /etc/rc.local echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local # 查看是否已经关闭 cat /sys/kernel/mm/redhat_transparent_hugepage/defrag cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
-
设置交换内存
# 临时修改 sysctl -w vm.swappiness=10 # 永久修改 echo "vm.swappiness=10" >> /etc/sysctl.conf
-
安装好JDK并且设置好环境变量
3、安装mysql
【建议直接安装mariadb】,因为mysql中会包含一些包,和cloudera-scm-agent冲突,如果你下载的版本不一致那么可能会遇到这种问题。不要慌到时候换一个mysql版本,或者查看一下cloudera-scm-agent中使用的mariadb包的版本,然后自己安装一个这样的包即可。我本人安装的为,下面文档仅为介绍方法,mysql版本切勿使用, 因为我这么安装就冲突了,建议使用5.5.60
Server version: 5.5.60-MariaDB MariaDB Server
mysql下载地址,可以根据你的需要下载mysql进行安装【官方安装介绍文档】
#1、解压tar包,并添加执行权限
## 解压tar包
tar xvf MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar -C /opt/software/mysql/ cd /opt/software/mysql/
## 添加执行权限
chmod u+x *.rpm
#2、安装MySQL-shared-compat替换系统自带的mysql-libs
# 先查看一下是否有系统自带的mysql插件,我这里是有的
rpm -qa | grep -i mysql
# 先安装MySQL-shared-compat
rpm -ivh MySQL-shared-compat-5.6.38-1.el6.x86_64.rpm
# 再卸载mysql-libs
yum remove mysql-libs
#3、安装mysql
# 安装MySQL-server
rpm -ivh MySQL-server-5.6.38-1.el6.x86_64.rpm
# 安装MySQL-client
rpm -ivh MySQL-client-5.6.38-1.el6.x86_64.rpm
安装完以后Mysql生成一个随机密码保存在/root/.mysql_secret
# 启动Mysql
service mysql start
# 不用再配置开机启动了,安装包已经设置Mysql开机启动
# 查看Mysql密码
more ~/.mysql_secret
# 进行Mysql的基本配置
/usr/bin/mysql_secure_installation --user=mysql
# 命令行登陆
Mysql mysql -uroot -p123456
# 添加远程登陆权限
Grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
# 重新加载权限
flush privileges;
mysql驱动jar包地址,可以根据你下载的mysql版本下载相应的jar驱动包,然后将该包改名为mysql-connector-java.jar
然后放在java的库中/usr/share/java目录中。所有节点都需要这么做。
4、配置yum parcel源
-
安装并开启httpd服务
# 安装httpd服务 yum install httpd #开启httpd服务 service httpd start #配置httpd服务开机自启 systemctl enable httpd.service
-
在软件目录解压镜像
# 创建软件目录 mkdir -p /opt/software/cloudera # 进入然间存放目录 cd /opt/software/cloudera #创建cloudera目录 mkdir CDH-6.3.0 # 将CDH的东西移动到刚创建的CDH目录中去 mv CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel CDH-6.3.0 mv CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha1 CDH-6.3.0 mv manifest.json CDH-6.3.0 # 解压cm软件 tar -zxvf cm6.3.0-redhat7.tar.gz.tar # 创建http服务映射 ln -s /opt/software/cloudera/cm6.3.0/ /var/www/html/cm ln -s /opt/software/cloudera/CDH-6.3.0/ /var/www/html/cdh
-
配置yum源
# 编辑第一个yum源配置 vim /etc/yum.repos.d/cloudera-manager.repo [cloudera-manager] name=Cloudera Manager,Version 6.3.0 baseurl=http://132.46.112.97/cm gpgcheck=0
# 编辑第二个yum源配置 vim /etc/yum.repos.d/cm.repo [cm] name=cm baseurl=http://132.46.112.97/cm enabled=1 gpgcheck=0
编辑了yum配置之后可以尝试一下是否生效
[root@p01 cdh]# yum search cloudera
记得要所有的节点配置这两个repo文件哦。让所有的节点都可以yum安装该软件
-
安装clouderamanager
# 给安装文件添加可执行权限。并且执行 ./cloudera-manager-installer.bin --skip_repo_package=1
执行的时候基本一路 Next、Next、Yes、Next、Yes然后就等待一会就可以成功了。
-
这时候已经添加了cloudera-scm-server和cloudera-scm-server-db服务,但是他使用的为内嵌数据库服务,要把它替换为mysql服务
[root@p01 cdh]# find / -name my.cnf
/etc/my.cnf
一般为/etc/my.cnf
[mysqld]
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
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
# For MySQL version 5.1.8 or later. For older versions, reference MySQL documentation for configuration help.
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/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_ALL_TABLES
修改之后重启一下
systemctl restart mysqld.service
还要建立一些数据库
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 hive.* to 'hive'@'%' identified by 'hive' with grant option;
grant all on oozie.* to 'oozie'@'%' identified by 'oozie' with grant option;
grant all on hue.* to 'hue'@'%' identified by 'hue' with grant option;
grant all on amon.* to 'amon'@'%' identified by 'amon' with grant option;
grant all on rman.* to 'rman'@'%' identified by 'rman' with grant option;
grant all on nav.* to 'nav'@'%' identified by 'nav' with grant option;
grant all on navms.* to 'navms'@'%' identified by 'navms' with grant option;
grant all on sentry.* to 'sentry'@'%' identified by 'sentry' with grant option;
flush privileges;
这样页面操作的时候就可以直接数据数据库名了。
-
给clouderamanager配置mysql数据库
[root@p01 ~]# find / -name scm_prepare_database.sh /opt/cloudera/cm/schema/scm_prepare_database.sh [root@p01 ~]# cd /opt/cloudera/cm/schema [root@p01 schema]# ./scm_prepare_database.sh mysql -uroot -p123456 scm scm scm JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.ea.28-7.el7.x86_64 Verifying that we can write to /etc/cloudera-scm-server Creating SCM configuration file in /etc/cloudera-scm-server Executing: /usr/lib/jvm/java-11-openjdk-11.0.ea.28-7.el7.x86_64/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db. [ main] DbCommandExecutor INFO Successfully connected to database. All done, your SCM database is configured correctly!
-
然后你就可以进入cdh的网页开始配置了,进行添加主机服务,这时基本上就完成了
-
配置完成之后,发现使用hdfs却没有权限,这是因为root用户和hdfs的权限映射不对,可以重新修改一下,将root用户添加到supergroup用户组中,然后将权限信息同步到hdfs
# 在Linux执行如下命令增加supergroup groupadd supergroup # 将用户root增加到supergroup中,再执行: usermod -a -G supergroup root #同步系统的权限信息到HDFS: su - hdfs -s /bin/bash -c "hdfs dfsadmin -refreshUserToGroupsMappings"
主机服务,这时基本上就完成了
-
配置完成之后,发现使用hdfs却没有权限,这是因为root用户和hdfs的权限映射不对,可以重新修改一下,将root用户添加到supergroup用户组中,然后将权限信息同步到hdfs
# 在Linux执行如下命令增加supergroup groupadd supergroup # 将用户root增加到supergroup中,再执行: usermod -a -G supergroup root #同步系统的权限信息到HDFS: su - hdfs -s /bin/bash -c "hdfs dfsadmin -refreshUserToGroupsMappings"
最后
以上就是如意口红为你收集整理的Centos7安装CDH6.3.0Centos7.6安装CDH6.3一般为/etc/my.cnf的全部内容,希望文章能够帮你解决Centos7安装CDH6.3.0Centos7.6安装CDH6.3一般为/etc/my.cnf所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复