use of com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions in project sofa-jraft by sofastack.
the class Server1 method main.
public static void main(final String[] args) {
final PlacementDriverOptions pdOpts = PlacementDriverOptionsConfigured.newConfigured().withFake(// use a fake pd
true).config();
final StoreEngineOptions storeOpts = //
StoreEngineOptionsConfigured.newConfigured().withStorageType(StorageType.RocksDB).withRocksDBOptions(RocksDBOptionsConfigured.newConfigured().withDbPath(Configs.DB_PATH).config()).withRaftDataPath(Configs.RAFT_DATA_PATH).withServerAddress(new Endpoint("127.0.0.1", 8181)).config();
final RheaKVStoreOptions opts = //
RheaKVStoreOptionsConfigured.newConfigured().withClusterName(//
Configs.CLUSTER_NAME).withUseParallelCompress(//
true).withInitialServerList(Configs.ALL_NODE_ADDRESSES).withStoreEngineOptions(//
storeOpts).withPlacementDriverOptions(//
pdOpts).config();
System.out.println(opts);
final Node node = new Node(opts);
node.start();
Runtime.getRuntime().addShutdownHook(new Thread(node::stop));
System.out.println("server1 start OK");
}
use of com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions in project sofa-jraft by sofastack.
the class Client method init.
public void init() {
final List<RegionRouteTableOptions> regionRouteTableOptionsList = MultiRegionRouteTableOptionsConfigured.newConfigured().withInitialServerList(-1L, /* default id */
Configs.ALL_NODE_ADDRESSES).config();
final PlacementDriverOptions pdOpts = //
PlacementDriverOptionsConfigured.newConfigured().withFake(//
true).withRegionRouteTableOptionsList(//
regionRouteTableOptionsList).config();
final RheaKVStoreOptions opts = //
RheaKVStoreOptionsConfigured.newConfigured().withClusterName(//
Configs.CLUSTER_NAME).withPlacementDriverOptions(//
pdOpts).config();
System.out.println(opts);
rheaKVStore.init(opts);
}
Aggregations