useradd -M -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
tar xf /opt/mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -s mysql-5.6.34-linux-glibc2.5-x86_64 mysql
cd /usr/local/mysql
echo "PATH=/usr/local/mysql/bin:$JAVA_HOME/bin:$PATH" >> /etc/profile
source /etc/profile
mkdir -p /data/mysql/mysql330{6,7,8,9}/{data,tmp,logs}
chown -R mysql:mysql /data/mysql/mysql330{6,7,8,9}
[root@matser mysql]# pwd
/usr/local/mysql
[root@matser mysql]# cat /data/mysql/mysql3306/my3306.cnf
#my.cnf
[client]
port = 3306
socket = /tmp/mysql3306.sock
#socket = /data/mysql/mysql3306/my3306.sock
[mysql]
prompt="\\u@\\h [\\d]>"
#pager="less -i -n -S"
#tee=/opt/mysql/query.log
no-auto-rehash
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /opt/mysql/mysqld_multi.log
[mysqld]
#misc
server-id=2513306
user = mysql
basedir = /usr/local/mysql
datadir = /data/mysql/mysql3306/data
port = 3306
socket = /tmp/mysql3306.sock
event_scheduler = 0
tmpdir = /data/mysql/mysql3306/tmp
#timeout
interactive_timeout = 300
wait_timeout = 300
#character set
character-set-server = utf8
open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
#lower_case_table_names =1
#logs
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
log_warnings = 2
pid-file = mysql.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1
#binlog
#binlog_format = STATEMENT
binlog_format = row
server-id = 23306
log-bin = /data/mysql/mysql3306/logs/mysql-bin
#binlog_cache_size = 4M
#max_binlog_size = 256M
#max_binlog_cache_size = 1M
sync_binlog = 0
expire_logs_days = 10
#procedure
log_bin_trust_function_creators=1
#
gtid-mode = 0
#relay log
skip_slave_start = 1
max_relay_log_size = 128M
relay_log_purge = 1
relay_log_recovery = 1
relay-log=relay-bin
relay-log-index=relay-bin.index
log_slave_updates
#slave-skip-errors=1032,1053,1062
#skip-grant-tables
#buffers & cache
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 128K
join_buffer_size = 128K
thread_cache_size = 200
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 100M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
./scripts/mysql_install_db --defaults-file=/data/mysql/mysql3306/my3306.cnf -- 初始化
mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf & -- 启动数据库
--- 开机自动启动数据库
echo "/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf &" >> /etc/rc.local
mysql -S /tmp/mysql3306.sock
mysqladmin -S /tmp/mysql3306.sock shutdown ---- 干净的关闭数据库
[root@matser mysql]# mysqladmin -S /tmp/mysql3306.sock shutdown
[root@matser mysql]# ps -ef | grep mysql
mysql 4201 3816 0 18:23 pts/1 00:00:01 mysqld --defaults-file=/data/mysql/mysql3307/my3307.cnf
root 4239 3816 0 18:28 pts/1 00:00:00 grep mysql
[1]- Done mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf
[root@cdh-slave1 ~]# mysql -S /tmp/mysql3306.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1060
Server version: 5.6.34-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password =password('oracle');
Query OK, 0 rows affected (0.37 sec)
mysql> source /opt/Init_mysql.sql 或是 复制下面的内容
create database cmf DEFAULT CHARACTER SET utf8;
grant all on cmf.* TO 'cmf'@'%' IDENTIFIED BY 'cmf_password';
grant all on cmf.* TO 'cmf'@'localhost' IDENTIFIED BY 'cmf_password';
create database amon DEFAULT CHARACTER SET utf8;
grant all on amon.* TO 'amon'@'%' IDENTIFIED BY 'amon_password';
grant all on amon.* TO 'amon'@'localhost' IDENTIFIED BY 'amon_password';
grant all on smon.* TO 'smon'@'%' IDENTIFIED BY 'smon_password';
grant all on smon.* TO 'smon'@'localhost' IDENTIFIED BY 'smon_password';
create database rman DEFAULT CHARACTER SET utf8;
grant all on rman.* TO 'rman'@'%' IDENTIFIED BY 'rman_password';
grant all on rman.* TO 'rman'@'localhost' IDENTIFIED BY 'rman_password';
create database hmon DEFAULT CHARACTER SET utf8;
grant all on hmon.* TO 'hmon'@'%' IDENTIFIED BY 'hmon_password';
grant all on hmon.* TO 'hmon'@'localhost' IDENTIFIED BY 'hmon_password';
create database nav DEFAULT CHARACTER SET utf8;
grant all on nav.* TO 'nav'@'%' IDENTIFIED BY 'nav_password';
grant all on nav.* TO 'nav'@'localhost' IDENTIFIED BY 'nav_password';
create database hive DEFAULT CHARACTER SET utf8;
grant all on hive.* TO 'hive'@'%' IDENTIFIED BY 'hive_password';
grant all on hive.* TO 'hive'@'localhost' IDENTIFIED BY 'hive_password';
create database rmon DEFAULT CHARACTER SET utf8;
grant all on rmon.* TO 'rmon'@'%' IDENTIFIED BY 'rmon_password';
grant all on rmon.* TO 'rmon'@'localhost' IDENTIFIED BY 'rmon_password';
create database oozie DEFAULT CHARACTER SET utf8;
grant all on oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie_password';
grant all on oozie.* TO 'oozie'@'localhost' IDENTIFIED BY 'oozie_password';
flush privileges;
=== 主机准备工作==
(1)主机名解析
[root@cdh1 local]# cat /etc/hosts | grepcdh
192.168.137.141 cdh1
192.168.137.142 cdh2
192.168.137.143 cdh3
2) 配置JavaMkdir –p /usr/java
tar xf jdk-7u79-linux-x64.tar.gz -C/usr/java
export JAVA_HOME=/usr/java/jdk1.7.0_79
exportCLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
exportPATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
(3)selinux 设置
[root@cdh1 local]# cat/etc/sysconfig/selinux |grep disable
# disabled - No SELinux policy is loaded.
SELINUX=disabled
(4)防火墙设置
[root@cdh1 local]# /etc/init.d/iptablesstatus
iptables: Firewall is not running.
[root@cdh1 local]# chkconfig iptables off
(5) 时间同步
ntpdate pool.ntp.org
-》第一处修改:修改为自己的网段
#Hosts on local network are less restricted.
restrict192.168.189.0 mask 255.255.255.0 nomodify notrap
-》第二处修改:将三个服务地址注释掉,因为不是外网不需要
#Use public servers from the pool.ntp.org project.
#Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server0.centos.pool.ntp.org
#server1.centos.pool.ntp.org
#server2.centos.pool.ntp.org
-》第三处修改:添加设置ntp本地服务
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
-》配置完成后,需要重启ntpd服务
$sudo service ntpd restart
crontab-e制定定时任务自动同步时间:
##synctime
0-59/10* * * * /usr/sbin/ntpdate cdh1
执行时间同步:
$sudo /usr/sbin/ntpdate cdh1
$sudo vi /etc/sysconfig/ntpd
$ sudo vi /etc/sysconfig/ntpd
与BIOS时间同步
#Drop root to id 'ntp:ntp' by default.
SYNC_HWCLOCK=yes 是否允许与BIOS系统时间同步
OPTIONS="-untp:ntp -p /var/run/ntpd.pid -g"===CM 离线安装前的准备工作===
下载CM 相关的软件,根据需求下载相关系统版本的CM软件,最好先本地下载好 然后再上传到Linux主机!
http://archive.cloudera.com/cdh5/parcels/ 下载地址
http://archive.cloudera.com/cm5/repo-as-tarball/ 地址
开始安装之前 要检查 HTTP服务是否正常运行
[root@node1 html]# pwd
/var/www/html
[root@node1 html]#mkdir parcels
[root@node1 html]#cd parcels
将下载好的软件上传到 该目录
CDH-5.7.6-1.cdh5.7.6.p0.6-el6.parcel
CDH-5.7.6-1.cdh5.7.6.p0.6-el6.parcel.sha1 -- 该文件需要重命名,去掉结尾的1 即可
manifest.json 文件
将cm5.7.0-centos6.tar.gz 上传到 /var/www/html/
tar xf cm5.7.0-centos6.tar.gz
[root@node1 html]# mkdir -p cm5/redhat/6/x86_64/
[root@node1 html]# mv cm cm5/redhat/6/x86_64/
sudo vim /etc/yum.repos.d/cloudera-manager.repo
[cloudera-manager]
name = Cloudera Manager, Version 5.7.6
baseurl = http://192.168.137.141/cm5/redhat/6/x86_64/cm/5/
gpgcheck = 0
8.浏览器查看下面两个网址是否出来,假如有,就配置成功
http://192.168.137.141/parcels/
http://1192.168.137.141/cm5/redhat/6/x86_64/cm/5/
===正常离线安装CM
cd /usr/share/java
unzipmysql-connector-java-5.1.40.zip
cdmysql-connector-java-5.1.40
cpmysql-connector-java-5.1.37-bin.jar /usr/share/java
1) 安装cm 软件
cd /var/www/html/cm5/redhat/6/x86_64/cm/5/RPMS/x86_64
yumisntall cloudera-manager-daemons-5.7.6-1.cm570.p0.76.el6.x86_64.rpm -y
yuminstall -y cloudera-manager-server-5.7.6-1.cm570.p0.76.el6.x86_64.rpm
2)modifycloudera-scm-server connect to MySQL
[root@node1 ~]#vi /etc/cloudera-scm-server/db.properties
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# This filedescribes the database connection.
#
# Thedatabase type
# Currently'mysql', 'postgresql' and 'oracle' are valid databases.
com.cloudera.cmf.db.type=mysql
# Thedatabase host
# If a nonstandard port is needed, use 'hostname:port'
com.cloudera.cmf.db.host=localhost
# Thedatabase name
com.cloudera.cmf.db.name=cmf
# Thedatabase user
com.cloudera.cmf.db.user=cmf
# Thedatabase user's password
com.cloudera.cmf.db.password=cmf_password
# The dbsetup type
# Bydefault, it is set to INIT
# Ifscm-server uses Embedded DB then it is set to EMBEDDED
# Ifscm-server uses External DB then it is set to EXTERNAL
com.cloudera.cmf.db.setupType=EXTERNAL
上面绿颜色的为 初次安装5.9及以后的版本 才会有必须选择外部源, 要是5.9之前的版本升级过来的话 这里可以不予理会
3) 启动CM 并安装配置CM 相关
service cloudera-scm-server start
#waiting 1 minute,open http://192.168.137.141:7180
#Logmessage:
User:admin
Password:admin
为 CDH 群集安装指定主机。 - Cloudera Manager
05选择存储库
#假如网络下载速度很堪忧,那么就配置 “本地存储库”,参考
06JDK安装选项(不勾选)
启用单用户模式(不启用)
提供SSH登录凭据
09正在安装
11 正在安装选定Parcel(安装前,将安装包下载到opt%cloudera%parcel-repo文件夹下,否则根据带宽慢慢download)
12检查主机准确性
13检查主机准确性--warnings
14 检查主机准确性--不适用.jpg
15 检查主机准确性--ok
16 选择您要在集群上安装的CDH5服务(HDFS+MapReduce+Zookeeper+Hive)
17自定义角色分配
18 数据库设置
审计更改