alluxio

How to set master address and 19998 port in Alluxio 2.0 java api?


I want to know how to set the hostname and rpc_port of master in alluxio 2.0 java api.

When I use the code that works in alluxio 1.8, I find that it doesn't work in alluxio 2.0.

Here is my code, it doesn't work. I don't know how to write correct code in alluxio 2.0 java api: enter image description here


Solution

  • In Alluxio 2, you can create a configuration object and then pass it to FileSystem.Factory.create().

    For example:

    InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
    conf.set(PropertyKey.MASTER_HOSTNAME, alluxioMaster);
    conf.set(PropertyKey.MASTER_RPC_PORT, ...);
    return FileSystem.Factory.create(conf);