只能读取hugegraph.properties文件进行配置吗?
String path = this.getClass().getClassLoader().getResource("hugegraph.properties").getPath();
HugeGraph hugeGraph = HugeFactory.open(path);
只能采取读取文件的方式进行配置吗?我们除了生产环境还有开发环境,所以不方便用文件配置,
我试了下面这种方式,无法生效,请问有什么好的方法吗?
conf.setProperty("backend","hbase");
conf.setProperty("serializer","hbase");
conf.setProperty("hbase.hosts",“”);
conf.setProperty("hbase.port",“”);
conf.setProperty("hbase.znode_parent",“”);
HugeGraph hugeGraph = HugeFactory.open(conf);
@youngkangrui 通过setProperty(k,v)也是可以的,请检查一下代码。另外,开发环境也可以通过命令行传参数的。
@youngkangrui 通过
setProperty(k,v)也是可以的,请检查一下代码。另外,开发环境也可以通过命令行传参数的。
PropertiesConfiguration conf = new PropertiesConfiguration();
conf.setProperty("backend","hbase");
conf.setProperty("serializer","hbase");
conf.setProperty("hbase.hosts","192.168.199.215,192.168.199.216,192.168.199.217");
conf.setProperty("hbase.port","2181");
conf.setProperty("hbase.znode_parent","/hbase");
HugeGraph hugeGraph = HugeFactory.open(conf);
这样写报错
“Exception in thread "main" com.baidu.hugegraph.config.ConfigException: Unable to load config file: null”,
看源码好像是要读文件地址
@youngkangrui 通过
setProperty(k,v)也是可以的,请检查一下代码。另外,开发环境也可以通过命令行传参数的。
PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty("backend","hbase"); conf.setProperty("serializer","hbase"); conf.setProperty("hbase.hosts","192.168.199.215,192.168.199.216,192.168.199.217"); conf.setProperty("hbase.port","2181"); conf.setProperty("hbase.znode_parent","/hbase"); HugeGraph hugeGraph = HugeFactory.open(conf);这样写报错 “Exception in thread "main" com.baidu.hugegraph.config.ConfigException: Unable to load config file: null”, 看源码好像是要读文件地址
是我没仔细看PropertiesConfiguration的用法,hugegraph是不让PropertiesConfiguration自动分隔的
改成下面这样就行了
PropertiesConfiguration conf = new PropertiesConfiguration();
conf.setDelimiterParsingDisabled(true);
conf.setProperty("backend","hbase");
conf.setProperty("serializer","hbase");
conf.setProperty("hbase.hosts", "ip1,ip2,ip3");
conf.setProperty("hbase.port","2181");
conf.setProperty("hbase.znode_parent","/hbase");
conf.setProperty("store","hugegraph");
conf.setProperty("store.graph",graphName);