您好,登錄后才能下訂單哦!
cdh 之 mysql的搭建
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。