成都网站建设设计

将想法与焦点和您一起共享

05-2-3cdh搭建之mysql搭建和jdk

cdh 之 MySQL的搭建

创新互联公司主营闻喜网站建设的网络公司,主营网站建设方案,重庆APP开发,闻喜h5重庆小程序开发搭建,闻喜网站营销推广欢迎闻喜等地区企业咨询

cdh6.10~5.16 支持mysql 5.1 5.5 5.6 5.7
cdh6.1~5.9 支持 5.1 5.5 5.6
cdh6.0 支持5.1 5.5
线上我们用的是mysql5.6
Cloudera Manager/CDH 5.9 - 5.16 mariadb 5.5 10.0
Cloudera Manager/CDH 5.5 - 5.8 mariadb 5.5
//我们建议在生产上使用mysql5.6系列
对于MySQL 5.6和5.7,您必须安装MySQL-shared-compat或MySQL-shared软件包。这是Cloudera Manager Agent软件包安装所必需的。

11、不支持基于MySQL GTID的复制。
//补充 GTID即全局事务ID,器保证为每一个在主上提交的事务在复制集群中可以生成一个唯一的ID.
基于GTID复制:
1.从服务器会告诉主服务器已执行的事务的GTID值。
2.主库会告诉从哪些GTID事务没有被执行。
同一个事务在指定的从库执行一次。

12、cdh不支持mysql的HA //但是我们可以用mysql从
13、要点:重新启动进程时,将使用Cloudera Manager数据库中保存的信息重新部署每个服务的配置。 如果此信息不可用,则群集无法启动或正常运行。 您必须安排并维护Cloudera Manager数据库的定期备份,以便在丢失此数据库时恢复群集。 有关更多信息,请参阅备份数据库。

具体操作如下:
在安装mysql前请先确定系统中没有安装mysql,需要卸载干净mysql
如何卸载干净mysql 参考链接:https://www.cnblogs.com/zhangjianbing/p/9039767.html
[root@hadoop02-182 ~]# find / -name mysql
/etc/selinux/targeted/active/modules/100/mysql
/usr/lib64/mysql
/usr/share/mysql

rm -rf /etc/selinux/targeted/active/modules/100/mysql
rm -rf /usr/lib64/mysql
rm -rf /usr/share/mysql

卸载mariadb
[root@centos7 mysql]# rpm -qa|grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@centos7 mysql]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
[root@centos7 mysql]# rpm -e --nodeps mariadb-libs-5.5.41-2.el7_0.x86_64
[root@centos7 mysql]# rpm -qa|grep mariadb

安装mysql
[root@hadoop01-181 ins]# cd mysql
[root@hadoop01-181 mysql]# ll
total 476148
-rw-r--r-- 1 root root 1223 Jan 11 2018 my.cnf
-rw-r--r-- 1 root root 243783680 Mar 27 14:11 MySQL-5.6.39-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 7155 31415 20323040 Dec 11 2017 MySQL-client-5.6.39-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 3533032 Dec 11 2017 MySQL-devel-5.6.39-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 93063020 Dec 11 2017 MySQL-embedded-5.6.39-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 62426388 Dec 11 2017 MySQL-server-5.6.39-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2105264 Dec 11 2017 MySQL-shared-5.6.39-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2299644 Dec 11 2017 MySQL-shared-compat-5.6.39-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 60026444 Dec 11 2017 MySQL-test-5.6.39-1.el7.x86_64.rpm

tar -zxvf MySQL-5.6.39-1.el7.x86_64.rpm-bundle.tar

安装mysql过程 //需要安装下面的顺序安装
rpm -ivh MySQL-shared-5.6.39-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.39-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.39-1.el7.x86_64.rpm
rpm -ivh MySQL-client-5.6.39-1.el7.x86_64.rpm
MySQL-devel-5.6.39-1.el7.x86_64.rpm //开发库,可以不装
MySQL-embedded-5.6.39-1.el7.x86_64.rpm //嵌入式版本可以不装
MySQL-test-5.6.39-1.el7.x86_64.rpm //可以不装

// 当出现
[root@cdh7-55-21 mysql]# rpm -ivh MySQL-server-5.6.39-1.el7.x86_64.rpm
warning: MySQL-server-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libaio.so.1()(64bit) is needed by MySQL-server-5.6.39-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.39-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.39-1.el7.x86_64
解决方法:
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libaio-0.3.109-13.el7.x86_64.rpm

rpm -ivh libaio-0.3.109-13.el7.x86_64.rpm
然后在执行
rpm -ivh MySQL-server-5.6.39-1.el7.x86_64.rpm 就可以了

若报错,若是版本冲突,则要先卸载默认安装的mysql-libs;若是缺少依赖,则安装
$> yum install -y perl-Module-Install.noarch
安装成功后,启动mysql systemctl start mysql
可通过more /root/.mysql_secret获取默认安装密码;
更改默认密码:
mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('hadoop');

b)mysql_secure_installation //初始化命令 运行mysql_secure_installation,更改root用户访问数据库的密码,禁止远程机器以root用户登录,禁止匿名登录
...
...
...

436 find / -name "my.cnf"
437 cp /usr/my.cnf /usr/my.cnf.back
439 cp /data/ins/mysql/my.cnf /usr/my.cnf
systemctl restart mysql
444 systemctl enable mysql
445 chkconfig --list
446 chkconfig mysql on
447 chkconfig --list

最后创建相应的库

mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION; 设置root权限远程访问
Query OK, 0 rows affected (0.06 sec)
#这句话的意思 ,允许任何IP地址(上面的 % 就是这个意思)的电脑 用admin帐户 和密码(admin)来访问这个MySQL Server

#必须加类似这样的帐户,才可以远程登陆。 root帐户是无法远程登陆的,只可以本地登陆

create database hive default character set utf8;
CREATE USER 'hive'@'%' IDENTIFIED BY 'hadoop';
GRANT ALL PRIVILEGES ON hive. * TO 'hive'@'%';
FLUSH PRIVILEGES;

create database hue default character set utf8;
CREATE USER 'hue'@'%' IDENTIFIED BY 'hadoop';
GRANT ALL PRIVILEGES ON hue. * TO 'hue'@'%';
FLUSH PRIVILEGES;

create database activity default character set utf8;
CREATE USER 'activity'@'%' IDENTIFIED BY 'hadoop';
GRANT ALL PRIVILEGES ON activity. * TO 'activity'@'%';
FLUSH PRIVILEGES;

create database oozie default character set utf8;
CREATE USER 'oozie'@'%' IDENTIFIED BY 'hadoop';
GRANT ALL PRIVILEGES ON oozie. * TO 'oozie'@'%';
FLUSH PRIVILEGES;

[root@hadoop01-181 mysql]# cat my.cnf 
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
password = 123456
port = 3306
default_character_set=utf8

[mysqld]
transaction-isolation = READ-COMMITTED

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
port = 3306
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
lower_case_table_names=1
max_connections=1000
default_storage_engine=INNODB

wait_timeout=31536000
interactive_timeout=31536000

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

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

[mysql]
default_character_set = utf8

安装jdk
rpm -ivh jdk-8u181-linux-x64.rpm


文章标题:05-2-3cdh搭建之mysql搭建和jdk
本文链接:http://chengdu.cdxwcx.cn/article/gedjdi.html