@zhaikun
2018-05-09T08:36:45.000000Z
字数 8121
阅读 1398
大数据
以下步骤要在所有节点上执行
vim /etc/sysconfig/network
若SELinux没有关闭,按照下述方式关闭[root@BigDataMaster ~]# vi /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 these two values:# targeted - Targeted processes are protected,# mls - Multi Level Security protection.SELINUXTYPE=targeted
[root@BigDataNode04 ~]# yum install bind-utils chkconfig cyrus-sasl-gssapi cyrus-sasl-plain fuse fuse-libs gcc httpd init-functions libxslt mod_ssl MySQL-python openssl openssl-devel perl portmap psmisc python-psycopg2 python-setuptools sed service sqlite swig useradd zlib
service iptables stop
把所有要添加到集群中的主机都要加入hosts中,格式如下:127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6172.16.132.160 BigDataMaster172.16.132.161 BigDataMaster02172.16.132.162 BigDataNode01172.16.132.163 BigDataNode02172.16.132.164 BigDataNode03172.16.132.165 BigDataNode04172.16.132.166 BigDataNode05172.16.132.167 BigDataNode06172.16.132.168 BigDataNode07172.16.132.169 BigDataNode08
软件的下载地址下载地址
下载CDH Parcel文件,只需要下载图中所示的3个文件

这里注意下,将.sha1文件后缀更改为.sha,同时把内容只保留hash码部分。
1、生成一个key[root@BigDataMaster ~]# ssh-keygen -t rsa2、将这个key传到所有节点[root@BigDataMaster ~]# ssh-copy-id -i .ssh/id_rsa.pub root@172.16.132.161
[root@BigDataNode01 ~]# mkdir /usr/local/java && tar zxvf jdk-8u101-linux-x64.tar.gz -C /usr/local/java[root@BigDataMaster parcel-repo]# vim /etc/profileexport JAVA_HOME=/usr/local/java/jdk1.8.0_101export PATH=$PATH:$JAVA_HOME/bin[root@BigDataMaster parcel-repo]# . /etc/profile
[root@BigDataMaster ~]# vim /opt/cm-5.7.6/etc/cloudera-scm-agent/config.ini[General]# Hostname of the CM server.server_host=172.16.132.160# Port that the CM server is listening on.server_port=7182
echo "vm.swappiness = 0" >>/etc/sysctl.conf && sysctl -p && echo never >/sys/kernel/mm/redhat_transparent_hugepage/defrag && echo "echo never >/sys/kernel/mm/redhat_transparent_hugepage/defrag" >>/etc/rc.local
[root@BigDataMaster] tar zxvf mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz -C /usr/local/[root@BigDataMaster] mv mysql-5.6.27-linux-glibc2.5-x86_64/ mysql[root@BigDataMaster] mkdir -p /data/mysql/mysql3306/{data,logs,tmp}[root@BigDataMaster] vim my3306.cnf#my.cnf[client]port = 3306socket = /tmp/mysql.sock[mysql]prompt='(test)\u@\h [\d]>'#tee=/data/mysql/mysql3306/data/query.logno-auto-rehash[mysqld]#miscuser = mysqlbasedir = /usr/local/mysql/datadir = /data/mysql/mysql3306/dataport = 3306socket = /tmp/mysql.sockevent_scheduler = 0#tmptmpdir=/data/mysql/mysql3306/tmplower_case_table_names = 1#timeoutinteractive_timeout = 300wait_timeout = 300#character setcharacter-set-server = utf8open_files_limit = 65535max_connections = 100max_connect_errors = 100000#skip-name-resolve = 1#logslog-output=fileslow_query_log = 1slow_query_log_file = slow.loglog-error = error.logpid-file = mysql.pidlong_query_time = 1#log-slow-admin-statements = 1log-queries-not-using-indexes = 1log-slow-slave-statements = 1explicit_defaults_for_timestamp=1#binlogbinlog_format = rowserver-id = 2203306log-bin = /data/mysql/mysql3306/logs/mysql-binbinlog_cache_size = 4Mmax_binlog_size = 1Gmax_binlog_cache_size = 2Gsync_binlog = 1innodb_flush_log_at_trx_commit = 1expire_logs_days = 10binlog_checksum = NONE # for GR#relay logrelay-log = /data/mysql/mysql3306/logs/relay-binskip_slave_start = 1max_relay_log_size = 1Grelay_log_purge = 0relay_log_recovery = 1log_slave_updates = 1#slave-skip-errors=1032,1053,1062# replicationrelay_log_recovery = ONmaster_info_repository = TABLErelay_log_info_repository = TABLE#buffers & cachetable_open_cache = 2048table_definition_cache = 2048table_open_cache = 2048max_heap_table_size = 96Msort_buffer_size = 2Mjoin_buffer_size = 2Mthread_cache_size = 256query_cache_size = 0query_cache_type = 0query_cache_limit = 256Kquery_cache_min_res_unit = 512thread_stack = 192Ktmp_table_size = 96Mkey_buffer_size = 8Mread_buffer_size = 2Mread_rnd_buffer_size = 16Mbulk_insert_buffer_size = 32M#myisammyisam_sort_buffer_size = 128Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1#innodbinnodb_buffer_pool_size = 100Minnodb_buffer_pool_instances = 4innodb_data_file_path = ibdata1:1G:autoextendinnodb_flush_log_at_trx_commit = 1innodb_log_buffer_size = 64Minnodb_log_file_size = 500Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 50innodb_file_per_table = 1innodb_rollback_on_timeoutinnodb_status_file = 1innodb_io_capacity = 2000transaction_isolation = READ-COMMITTEDinnodb_flush_method = O_DIRECT[mysqld_safe]#malloc-lib=/usr/local/mysql/lib/jmalloc.sonice=-19open-files-limit=65535[root@BigDataMaster] /usr/local/mysql_install_db --defaults-file=/data/mysql/mysql3306/my3306.cnf
1、首先需要去MySql的官网下载JDBC驱动,http://dev.mysql.com/downloads/connector/j/,解压后,找到mysql-connector-java-5.1.35-bin.jar,放到/opt/cm-5.7.6/share/cmf/lib/中。
[root@BigDataMaster mysql-connector-java-5.1.41]# cp mysql-connector-java-5.1.41-bin.jar /opt/cm-5.7.6/share/cmf/lib/
2、在主节点初始化CM5的数据库:
mysql> CREATE USER 'scm'@'%' IDENTIFIED BY 'scm';Query OK, 0 rows affected (0.01 sec)mysql> grant all privileges on *.* to 'scm'@'%' with grant option;Query OK, 0 rows affected (0.01 sec)mysql> grant all privileges on *.* to 'root'@'%' with grant option;Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
初始化
[root@BigDataMaster schema]# /opt/cm-5.7.6/share/cmf/schema/scm_prepare_database.sh mysql -hlocalhost -uroot -p123456 --scm-host localhost scm scm scmJAVA_HOME=/usr/local/java/jdk1.8.0_101Verifying that we can write to /opt/cm-5.7.6/etc/cloudera-scm-serverCreating SCM configuration file in /opt/cm-5.7.6/etc/cloudera-scm-servergroups: cloudera-scm:无此用户Executing: /usr/local/java/jdk1.8.0_101/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/opt/cm-5.7.6/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/cm-5.7.6/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!
[root@BigDataNode04 ~]# scp -r /opt/cm-5.7.6/ root@172.16.132.169:/opt/
[root@BigDataNode04 ~]# /opt/cm-5.7.6/etc/init.d/cloudera-scm-server start
[root@BigDataNode04 ~]# /opt/cm-5.7.6/etc/init.d/cloudera-scm-agent start









据说此问题是BUG,修复方法
错误日志
-yarn/stacks', u'bytes_free_warning_threshhold_bytes': 0, u'group': u'hadoop', u'user': u'yarn', u'mode': 493}, u'cpu': None, u'contents': NoneTraceback (most recent call last):File "/opt/cm-5.7.6/lib64/cmf/agent/build/env/lib/python2.6/site-packages/cmf-5.7.6-py2.6.egg/cmf/agent.py", line 1605, in handle_heartbeat_pnew_process.activate()File "/opt/cm-5.7.6/lib64/cmf/agent/build/env/lib/python2.6/site-packages/cmf-5.7.6-py2.6.egg/cmf/agent.py", line 3144, in activateself.write_process_conf()File "/opt/cm-5.7.6/lib64/cmf/agent/build/env/lib/python2.6/site-packages/cmf-5.7.6-py2.6.egg/cmf/agent.py", line 3251, in write_process_conf"source_parcel_environment", env))File "/opt/cm-5.7.6/lib64/cmf/agent/build/env/lib/python2.6/site-packages/cmf-5.7.6-py2.6.egg/cmf/util.py", line 373, in sourceraise eValueError: dictionary update sequence element #93 has length 1; 2 is required
修复方法:
[root@BigDataNode06 cloudera-scm-agent]# vim /opt/cm-5.7.6/lib64/cmf/agent/build/env/lib/python2.6/site-packages/cmf-5.7.6-py2.6.egg/cmf/util.py#原样子LOG.warn("None environment value: %s=%s" % (k, v,))pipe = subprocess.Popen(['/bin/bash', '-c', ". %s; %s; env" % (path, command)],stdout=subprocess.PIPE, env=caller_env)data = pipe.communicate()[0]try:#修复pipe = subprocess.Popen(['/bin/bash', '-c', ". %s; %s; env| grep -v { | grep -v }" % (path, command)],stdout=subprocess.PIPE, env=caller_env)data = pipe.communicate()[0]try:return dict((line.split("=", 1) for line in data.splitlines()))except Exception, e:
[root@BigDataNode04 tools]# cp mysql-connector-java-5.1.41-bin.jar /opt/cloudera/parcels/CDH/lib/hive/lib/
最好从已经运行的slave机器上scp对应的文件夹,不用修改server_host了,但是需要把对应的[/opt/cm-5.7.0/lib/cloudera-scm-agent]下的文件全部删除;同时删除[/opt/cm-5.7.0/log/cloudera-scm-agent]目录下的所有内容。

