Datasophon的Ranger安装时数据库踩坑及问题解决
我司安装大数据平台,要用到Ranger,Ranger可支持mysql, postressql等数据库,但我司使用的是Datasophon平台,而ddp只支持mysql,可能是其它组件有些不支持postgres吧。
另外一篇数据库踩坑的文章参考一下:https://blog.csdn.net/weixin_45357522/article/details/148868357
特别注意的是,mysql只能用5.7,不要用其它版本。centos7.4默认的是mariadb5.5,我为图省事,直接使用5.5版本,结果很多索引创建的问题,后来改用mariadb12,但安装ranger时老是报删除表时,FK导致删除失败,再后来改用5.7完全没问题了。但我后来又改成了5.7主备模式之后,又报函数创建错误。总结如下:
1、只能用mysql5.7
2、安装完之后,使用如下命令找到初始密码:
grep "password" /var/log/mysqld.log
3、登录mysql后,修改密码规则,不然密码要求比较高:
set global validate_password_policy='low';
set global validate_password_length = 6;
4、修改root密码
alter user 'root'@'localhost' identified by '8888';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '8888' WITH GRANT OPTION;
5、修改选项,以便函数可以正常创建
SET GLOBAL log_bin_trust_function_creators = 1;
6、主备模式:
6.1、主库:
my.cnf
server-id=1
log-bin=mysql-bin
重启
再用mysql 执行 show master status;
记录MASTER_LOG_FILE和MASTER_LOG_POS
6.2、备库:
my.cnf
server-id=2
relay-log=mysql-relay-bin
read_only=1
重启
进入mysql,执行如下命令:
stop slave;
CHANGE MASTER TO
MASTER_HOST=‘dmp-rdb-svr1’,
MASTER_USER=‘slave’,
MASTER_PASSWORD=‘dmp@clone!’,
MASTER_LOG_FILE=‘mariadb-bin.000003’,
MASTER_LOG_POS=78466;
START SLAVE;
show slave status \G;
这时应该有如下两个内容:
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
7、创建库和用户:
CREATE DATABASE IF NOT EXISTS datasophon DEFAULT CHARACTER SET utf8;
grant all privileges on *.* to datasophon@"%" identified by 'datasophon123' with grant option;
grant all privileges on *.* to datasophon@"localhost" identified by 'datasophon123' with grant option;
FLUSH PRIVILEGES;CREATE DATABASE IF NOT EXISTS hive DEFAULT CHARACTER SET utf8;
grant all privileges on *.* to hive@"%" identified by 'hive123' with grant option;
FLUSH PRIVILEGES;CREATE DATABASE IF NOT EXISTS ranger DEFAULT CHARACTER SET utf8;
grant all privileges on *.* to ranger@"%" identified by 'ranger123' with grant option;
grant all privileges on *.* to ranger@"localhost" identified by 'ranger123' with grant option;
FLUSH PRIVILEGES;CREATE DATABASE dolphin DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dolphin.* TO 'dolphin'@'%' IDENTIFIED BY 'dolphin123';
GRANT ALL PRIVILEGES ON dolphin.* TO 'dolphin'@'localhost' IDENTIFIED BY 'dolphin123';
flush privileges;