Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Juicedata
JuiceFS
提交
15f5dd0c
JuiceFS
项目概览
Juicedata
/
JuiceFS
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
JuiceFS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
15f5dd0c
编写于
1月 31, 2021
作者:
T
tangyoupeng
提交者:
GitHub
1月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hadoop: add FlinkFileSystemFactory (#159)
* hadoop: add FlinkFileSystemFactory * hadoop: update * hadoop: update
上级
294b75ba
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
105 addition
and
2 deletion
+105
-2
docs/hadoop_java_sdk_cn.md
docs/hadoop_java_sdk_cn.md
+9
-2
sdk/java/pom.xml
sdk/java/pom.xml
+15
-0
sdk/java/src/main/java/io/juicefs/FlinkFileSystemFactory.java
...java/src/main/java/io/juicefs/FlinkFileSystemFactory.java
+67
-0
sdk/java/src/main/resources/META-INF/services/org.apache.flink.core.fs.FileSystemFactory
...A-INF/services/org.apache.flink.core.fs.FileSystemFactory
+14
-0
未找到文件。
docs/hadoop_java_sdk_cn.md
浏览文件 @
15f5dd0c
...
...
@@ -43,6 +43,7 @@ $ make
| ---- | ---- |
| Spark |
`${SPARK_HOME}/jars`
|
| Presto |
`${PRESTO_HOME}/plugin/hive-hadoop2`
|
| Flink |
`${FLINK_HOME}/lib`
|
## 配置参数
...
...
@@ -83,8 +84,6 @@ $ make
### 常用配置
将以下配置参数加入到 Hadoop 配置文件
`core-site.xml`
中:
```
xml
<property>
<name>
fs.jfs.impl
</name>
...
...
@@ -112,6 +111,14 @@ $ make
</property>
```
#### Hadoop 环境配置
将配置参数加入到 Hadoop 配置文件
`core-site.xml`
中:
#### Flink 配置
将配置参数加入
`conf/flink-conf.yaml`
。如果只是在 Flink 中使用 JuiceFS, 可以不在 Hadoop 环境配置 JuiceFS,只需要配置 Flink 客户端即可。
### 验证
#### Hadoop
...
...
sdk/java/pom.xml
浏览文件 @
15f5dd0c
...
...
@@ -57,6 +57,9 @@
<resource>
<directory>
libjfs/target
</directory>
</resource>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
<testResources>
<testResource>
...
...
@@ -124,6 +127,18 @@
</scope>
<version>
1.2.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-hadoop-fs
</artifactId>
<version>
1.10.3
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-core
</artifactId>
<version>
1.10.3
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.apache.hadoop
</groupId>
<artifactId>
hadoop-minicluster
</artifactId>
...
...
sdk/java/src/main/java/io/juicefs/FlinkFileSystemFactory.java
0 → 100644
浏览文件 @
15f5dd0c
/*
* JuiceFS, Copyright (C) 2020 Juicedata, Inc.
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
io.juicefs
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.core.fs.FileSystem
;
import
org.apache.flink.runtime.fs.hdfs.HadoopFileSystem
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.net.URI
;
public
class
FlinkFileSystemFactory
implements
org
.
apache
.
flink
.
core
.
fs
.
FileSystemFactory
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
FlinkFileSystemFactory
.
class
);
private
org
.
apache
.
hadoop
.
conf
.
Configuration
conf
;
private
static
final
String
[]
FLINK_CONFIG_PREFIXES
=
{
"fs."
,
"juicefs."
};
private
String
scheme
;
@Override
public
void
configure
(
Configuration
config
)
{
conf
=
new
org
.
apache
.
hadoop
.
conf
.
Configuration
();
if
(
config
!=
null
)
{
for
(
String
key
:
config
.
keySet
())
{
for
(
String
prefix
:
FLINK_CONFIG_PREFIXES
)
{
if
(
key
.
startsWith
(
prefix
))
{
String
value
=
config
.
getString
(
key
,
null
);
if
(
value
!=
null
)
{
if
(
"io.juicefs.JuiceFileSystem"
.
equals
(
value
.
trim
()))
{
this
.
scheme
=
key
.
split
(
"\\."
)[
1
];
}
conf
.
set
(
key
,
value
);
}
}
}
}
}
}
@Override
public
String
getScheme
()
{
if
(
scheme
==
null
)
{
return
"jfs"
;
}
return
scheme
;
}
@Override
public
FileSystem
create
(
URI
fsUri
)
throws
IOException
{
JuiceFileSystem
fs
=
new
JuiceFileSystem
();
fs
.
initialize
(
fsUri
,
conf
);
return
new
HadoopFileSystem
(
fs
);
}
}
sdk/java/src/main/resources/META-INF/services/org.apache.flink.core.fs.FileSystemFactory
0 → 100644
浏览文件 @
15f5dd0c
# JuiceFS, Copyright (C) 2020 Juicedata, Inc.
#
# This program is free software: you can use, redistribute, and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# or later ("AGPL"), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
io.juicefs.FlinkFileSystemFactory
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录