2、cd /opt/cloudera/parcel-repo
(1)将第一部分下载的CDH Parcel文件(CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcelCDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha256和manifest.json)上传至该目录下
(2)mv CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha256 CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha
(3)chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/*
3、将mysql-connector-java-5.1.47-bin.jar文件上传至CM Server节点上的/usr/share/java/目录下并重命名为mysql-connector-java.jar
4、安装 mysql(安装过程略),并创建相应库
mysql>CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci
mysql>CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci
mysql>CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci
mysql>CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci
mysql>GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm'
mysql>GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon'
mysql>GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman'
mysql>GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'hive'
mysql>FLUSH PRIVILEGES
执行命令:/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
mysql数据库与CM Server不在同一台主机上
执行命令:/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h --scm-host scm scm
5、启动cloudera-scm-server
systemctl start cloudera-scm-server
6、登录页面进行配置
ip:7180
有个连接数据库的jar包用来驱动
2.连接数据库,具体代码网上有,主要就是设置数据库类型,名字,用户名,密码之类的
3.调用连接,写入数据,
Connection con=new Connection()
String sql="insert into 表名 (列名1,列名2) values(值1,值2)"
PreparedStatement ps=con.getPerpareStatment()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)