1.flink1.10.0连接apache-hive-2.3.7(Java程序)
2.在Ubuntu里面搭建四个节点内存怎么分配?
3.å¦ä½å¨MaxComputeä¸è¿è¡HadoopMRä½ä¸
4.描述脚本一键启动HDFS集群和Yarn集群前的源码准备工作和启动的方法?
flink1.10.0连接apache-hive-2.3.7(Java程序)
通过Java程序连接Apache Flink 1..0与Apache Hive 2.3.7,主要步骤如下:
第一步:添加依赖,源码包括以下库:
org.apache.flink flink-table-planner-blink_2. 1..0
org.apache.flink flink-connector-hive_2. 1..0
org.apache.flink flink-table-api-java-bridge_2. 1..0
org.apache.hive hive-exec ${ hive.version} provided
org.apache.hadoop hadoop-mapreduce-client-core 2.7.3
org.apache.hadoop hadoop-common 2.7.3
org.apache.hadoop hadoop-mapreduce-client-common 2.7.3
org.apache.hadoop hadoop-mapreduce-client-jobclient 2.7.3
org.apache.flink flink-shaded-hadoop-2-uber 2.7.5-8.0 provided
org.datanucleus datanucleus-api-jdo 4.2.4
org.datanucleus datanucleus-core 4.1.
org.datanucleus datanucleus-rdbms 4.1.
mysql mysql-connector-java 8.0.
org.datanucleus javax.jdo 3.2.0-m3
第二步:编写程序,源码加载hive-site.xml,源码thinkphp小贷超市源码并执行如下代码:
java
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.TableEnvironment;
import org.apache.flink.table.catalog.hive.HiveCatalog;
public class HiveConnect {
public static void main(String[] args) {
EnvironmentSettings settings = EnvironmentSettings
.newInstance()
.useBlinkPlanner()
.inBatchMode()
.build();
TableEnvironment tableEnv = TableEnvironment.create(settings);
String name = "myhive";
String defaultDatabase = "ydj";
String hiveConfDir = "D:\\OfficeWork\\WorkSpace\\GitLab\\big-data-extension\\achilles-algorithm-platform\\src\\main\\resources";
String version = "2.3.4";
HiveCatalog hive = new HiveCatalog(name,源码 defaultDatabase, hiveConfDir, version);
tableEnv.registerCatalog("myhive", hive);
tableEnv.useCatalog("myhive");
String createDbSql = "select * from ydj.center";
Table table = tableEnv.sqlQuery(createDbSql);
System.out.println(table);
}
}
在Ubuntu里面搭建四个节点内存怎么分配?
一、硬件配置以及操作系统:
所需要的源码机器以及操作系统:一台mac os笔记本、一台window笔记本(CPU双核四线程,源码内存8G),源码其中mac os用于远程操作,源码window笔记本装有虚拟机,源码虚拟出3个ubuntu.系统(配置CPU1个线程2个,源码mint ui loadmore源码内存1.5G,源码硬盘分配每个G),源码对于mac os(可以用window机或者linux机)的源码配置没有要求
使用vm创建3个ubuntu.系统,一个主节点:master(NameNode)和两个从节点slave1(DataNode)和slave2(DataNode)
节点IP分配:主节点IP为:..0.、源码从节点1IP为:..0.、亮钻源码下载从节点2IP为:..0.
虚拟机的网络选择桥接模式与物理网络的网段相同,这样有助于远程连接。
master的主机名为:sunxj-hdm,slave1的主机名为:sunxj-hds1,slave2的主机名为:sunxj-hds2,如下图所示:
定义域名:sunxj-hdm.myhd.com(master),easyui时间控件源码sunxj-hds1.myhd.com(slave1),sunxj-hds2.myhd.com(slave2)
配置hosts,将3台的hosts配置为:
..0. sunxj-hdm.myhd.com..0. sunxj-hds1.myhd.com ..0. sunxj-hds2.myhd.com
如下图所示:
注意:不能放在最下边,从注释行开始往下是配置ipv6的,ip和域名之间必须是web文件列表源码一个tab,且域名后不能有空格,否则是ping不通的,还有3个主机必须配置相同才能互ping。
7.然后使用如下命令进行重启网络
sudo /etc/init.d/networking restart
如下图所示:
8、然后通过ping sunxj-hds1.myhd.com查看是否可以ping的通,如果是通的则配置成功,如果不通需要在找原因了,如下图所示:
在master机ping slave1和slave2
在 slave1机ping master和slave2
在 slave2机ping master和slave1
二、节点需要安装的工具:
三个节点需要安装的工具为:vm-tool、gcc、net-tools、openssh-server、vsftpd、vim(用于ftp服务)
安装顺序:
(1)sudo apt install gcc
(2) 安装vm-tool
(3)sudo apt install net-tools
(4)sudo apt install vim
(5)sudo apt install openssh-server(可以使用/etc/init.d/ssh start 启动ssh)
(6)在安装好ssh后即可远程操作,在macos中打开终端进行ssh远程连接,如下图所示:
(7)安装ftp服务并配置vsftpd请看:t bigint);
éè¿tunnelå°æ°æ®å¯¼å ¥è¾å ¥è¡¨ä¸
å¾ å¯¼å ¥ææ¬æ件data.txtçæ°æ®å 容å¦ä¸ï¼
hello maxcompute
hello mapreduce
ä¾å¦å¯ä»¥éè¿å¦ä¸å½ä»¤å°data.txtçæ°æ®å¯¼å ¥wc_inä¸ï¼
tunnel upload data.txt wc_in;
4. åå¤å¥½è¡¨ä¸hdfsæ件路å¾çæ å°å ³ç³»é ç½®
é ç½®æ件å½å为ï¼wordcount-table-res.conf
{
"file:/foo": {
"resolver": {
"resolver": "c.TextFileResolver",
"properties": {
"text.resolver.columns.combine.enable": "true",
"text.resolver.seperator": "\t"
}
},
"tableInfos": [
{
"tblName": "wc_in",
"partSpec": { },
"label": "__default__"
}
],
"matchMode": "exact"
},
"file:/bar": {
"resolver": {
"resolver": "openmr.resolver.BinaryFileResolver",
"properties": {
"binary.resolver.input.key.class" : "org.apache.hadoop.io.Text",
"binary.resolver.input.value.class" : "org.apache.hadoop.io.LongWritable"
}
},
"tableInfos": [
{
"tblName": "wc_out",
"partSpec": { },
"label": "__default__"
}
],
"matchMode": "fuzzy"
}
}
描述脚本一键启动HDFS集群和Yarn集群前的准备工作和启动的方法?
给你个脚本,修改一下自己的服务器地址就行,启动直接加个start运行该脚本 ,停止加个stop运行该脚本
#!/bin/bash
if [ $# -lt 1 ]
then
echo "No Args Input..."
exit;
fi
case $1 in
"start")
echo " =================== 启动Hadoop集群 ==================="
echo " ------------------- 启动HDFS -------------------"
ssh hadoop "/opt/module/hadoop-2.7.2/sbin/start-dfs.sh"
echo " ------------------- 启动YARN -------------------"
ssh hadoop "/opt/module/hadoop-2.7.2/sbin/start-yarn.sh"
;;
"stop")
echo " =================== 关闭Hadoop集群 =================="
echo " ------------------- 关闭YARN ------------------"
ssh hadoop "/opt/module/hadoop-2.7.2/sbin/stop-yarn.sh"
echo " ------------------- 关闭HDFS ------------------"
ssh hadoop "/opt/module/hadoop-2.7.2/sbin/stop-dfs.sh"
;;
*)
esac