vlambda博客
学习文章列表

CDH5.16.2安装部署(二)MySQL5.7.11离线部署

一、MySQL离线安装

1、解压及创建目录

[root@hadoop001 cdh5162]# tar -xf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz /usr/local/[root@hadoop001 local]# mv mysql-5.7.11-linux-glibc2.5-x86_64 mysql[root@hadoop001 local]# mkdir mysql/arch mysql/data mysql/tmp

2、创建my.cnf

[root@hadoop001 local]# cp /etc/my.cnf /etc/my.cnf.bak
[client]port = 3306socket = /usr/local/mysql/data/mysql.sockdefault-character-set=utf8mb4 [mysqld]port = 3306socket = /usr/local/mysql/data/mysql.sock skip-slave-start skip-external-lockingkey_buffer_size = 256Msort_buffer_size = 2Mread_buffer_size = 2Mread_rnd_buffer_size = 4Mquery_cache_size= 32Mmax_allowed_packet = 16Mmyisam_sort_buffer_size=128Mtmp_table_size=32M table_open_cache = 512thread_cache_size = 8wait_timeout = 86400interactive_timeout = 86400max_connections = 600 # Try number of CPU's*2 for thread_concurrency#thread_concurrency = 32  #isolation level and default engine default-storage-engine = INNODBtransaction-isolation = READ-COMMITTED server-id = 1739basedir = /usr/local/mysqldatadir = /usr/local/mysql/datapid-file = /usr/local/mysql/data/hostname.pid #open performance schemalog-warningssysdate-is-now binlog_format = ROWlog_bin_trust_function_creators=1log-error = /usr/local/mysql/data/hostname.errlog-bin = /usr/local/mysql/arch/mysql-binexpire_logs_days = 7 innodb_write_io_threads=16 relay-log = /usr/local/mysql/relay_log/relay-logrelay-log-index = /usr/local/mysql/relay_log/relay-log.indexrelay_log_info_file= /usr/local/mysql/relay_log/relay-log.info log_slave_updates=1gtid_mode=OFFenforce_gtid_consistency=OFF # slaveslave-parallel-type=LOGICAL_CLOCKslave-parallel-workers=4master_info_repository=TABLErelay_log_info_repository=TABLErelay_log_recovery=ON #other logs#general_log =1#general_log_file = /usr/local/mysql/data/general_log.err#slow_query_log=1#slow_query_log_file=/usr/local/mysql/data/slow_log.err #for replication slavesync_binlog = 500  #for innodb options innodb_data_home_dir = /usr/local/mysql/data/innodb_data_file_path = ibdata1:1G;ibdata2:1G:autoextend innodb_log_group_home_dir = /usr/local/mysql/archinnodb_log_files_in_group = 4innodb_log_file_size = 1Ginnodb_log_buffer_size = 200M #根据生产需要,调整pool size innodb_buffer_pool_size = 2G#innodb_additional_mem_pool_size = 50M #deprecated in 5.6tmpdir = /usr/local/mysql/tmp innodb_lock_wait_timeout = 1000#innodb_thread_concurrency = 0innodb_flush_log_at_trx_commit = 2 innodb_locks_unsafe_for_binlog=1 #innodb io features: add for mysql5.5.8performance_schemainnodb_read_io_threads=4innodb-write-io-threads=4innodb-io-capacity=200#purge threads change default(0) to 1 for purgeinnodb_purge_threads=1innodb_use_native_aio=on #case-sensitive file names and separate tablespaceinnodb_file_per_table = 1lower_case_table_names=1 [mysqldump]quickmax_allowed_packet = 128M [mysql]no-auto-rehashdefault-character-set=utf8mb4 [mysqlhotcopy]interactive-timeout [myisamchk]key_buffer_size = 256Msort_buffer_size = 256Mread_buffer = 2Mwrite_buffer = 2M


3、创建用户组及用户

[root@hadoop001 local]# groupadd -g 101 dba[root@hadoop001 local]# useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladminuseradd: warning: the home directory already exists.Not copying any file from skel directory into it.[root@hadoop001 local]# su mysqladminbash-4.2$

4、切换为mysqladmin用户显示bash-4.2$,根据提示是home目录已存在,没有靠背skel 配置文件,手动拷贝到mysql下

[root@hadoop001 mysql-5.7.11-linux-glibc2.5-x86_64]# cp /etc/skel/.* /usr/local/mysqlcp: omitting directory ‘/etc/skel/.’cp: omitting directory ‘/etc/skel/..’[root@hadoop001 mysql-5.7.11-linux-glibc2.5-x86_64]# su mysqladmin[mysqladmin@hadoop001 ~]$ 

5、配置环境变量

[mysqladmin@hadoop001 ~]$ su root[root@hadoop001 mysql]# vi /usr/local/mysql/.bash_profile
export MYSQL_BASE=/usr/local/mysqlexport PATH=${MYSQL_BASE}/bin:$PATH  unset USERNAME #stty erase ^Hset umask to 022umask 022PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1 ## end

6、赋权限和用户组

[root@hadoop001 local]# chown mysqladmin:dba /etc/my.cnf[root@hadoop001 local]# chmod 640 /etc/my.cnf[root@hadoop001 local]# chown -R mysqladmin:dba /usr/

[root@hadoop001 local]# chmod -R 755 /usr/local/mysql

7、配置服务及开启自启动

[root@hadoop001 mysql]# cd /usr/local/mysql/[root@hadoop001 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql[root@hadoop001 mysql]# chmod +x /etc/rc.d/init.d/mysql [root@hadoop001 mysql]# chkconfig --add mysql[root@hadoop001 mysql]# chkconfig --level 345 mysql on

 8、安装libaio及安装mysql的初始db

[root@hadoop001 mysql]# yum -y install libaio
[root@hadoop001 mysql]# su - mysqladmin
hadoop001:mysqladmin:/usr/local/mysql:>bin/mysqld \> --defaults-file=/etc/my.cnf \> --user=mysqladmin \> --basedir=/usr/local/mysql/ \> --datadir=/usr/local/mysql/data/ \> --initialize

9、查看临时密码

hadoop001:mysqladmin:/usr/local/mysql:> cd datahadoop001:mysqladmin:/usr/local/mysql/data:>cat hostname.err | grep password2020-05-17T08:23:24.112777Z 1 [Note] A temporary password is generated for root@localhost: n9s-.zTbuKgihadoop001:mysqladmin:/usr/local/mysql/data:>

10、启动

/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &

11、登录及修改用户密码

hadoop001:mysqladmin:/usr/local/mysql/data:>mysql -uroot -p'n9s-.zTbuKgi'
mysql> alter user root@localhost identified by 'zoro';mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'zoro' ;mysql> flush privileges;mysql> exit;

12、重启

hadoop001:mysqladmin:/usr/local/mysql/data:>service mysql restarthadoop001:mysqladmin:/usr/local/mysql/data:>mysql -uroot -pzoro

二、CM元数据存储数据库

mysql> create database cmf default character set utf8;Query OK, 1 row affected (0.00 sec)

mysql> mysql> grant all privileges on cmf.* to cmf@'%' identified by 'cmf';Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> mysql> create database amon default character set utf8;Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on amon.* to amon@'%' identified by 'amon';Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)

三、mysql 驱动包

[root@hadoop001 cdh5162]# mkdir -p /usr/share/java
[root@hadoop001 cdh5162]# cp mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar

CDH5.16.2安装部署(二)MySQL5.7.11离线部署

最新文章:









2020若泽数据高级班9期,Spark+Flink全栈训练营,开课啦

1.官网介绍 

http://www.ruozedata.com/advanced.html 

底部[阅读原文],单击直接跳转,先看看,先初步了解课程内容

2.课程时间:

  • 开课时间: 2020-07-01

  • 课程周期: 4.5个月(节假日除外)

  • 上课时间: 周三21-23点、周六周日22-20点,一周至少三次课程;

    根据学员情况,周末额外补课

  • 一年只开2期: 半年周期为一期,2020下半年就这一期

3.讲师团队:

  • 以若泽PK+J哥为主若泽数据团队,企业在职

  • 若泽PK,北京西二旗某司大数据架构师

  • J哥,上海某金融机构大数据负责人

赶快咨询哟

单击[阅读原文],高级班课表