alibabacloud-jindodata
alibabacloud-jindodata copied to clipboard
初始化 FileSystem实例过程中如何开启缓存模式
我在看网上文档介绍说:
JindoFS 有两种使用模式, 块存储模式(BLOCK)和缓存模式(CACHE)。 下面我们介绍下如何在 EMR 中配置和使用 JindoFS 以及不同模式对应的场景。
具体在 https://github.com/aliyun/alibabacloud-jindodata/blob/master/docs/user/4.x/4.6.x/4.6.11/jindofs/hadoop/jindosdk_ide_hadoop.md 这个文档中,在初始化FileSystem 这个实例过程中,可以设置什么参数开启 缓存模式(CACHE)? 能否指点一二
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import java.net.URI;
public class TestJindoSDK {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("fs.oss.impl", "com.aliyun.jindodata.oss.JindoOssFileSystem");
conf.set("fs.AbstractFileSystem.oss.impl", "com.aliyun.jindodata.oss.OSS");
conf.set("fs.jindofsx.data.cache.enable", "true");
// set accessKey, secret, endpoint and so on.
FileSystem fs = FileSystem.get(URI.create("oss://<Bucket>.<HDFS_Endpoint>/"), conf);
FSDataInputStream in = fs.open(new Path("/uttest/file1"));
in.read();
in.close();
}
}