Search in sources :

Example 6 with PlacementDriverOptions

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");
}
Also used : RheaKVStoreOptions(com.alipay.sofa.jraft.rhea.options.RheaKVStoreOptions) PlacementDriverOptions(com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions) Endpoint(com.alipay.sofa.jraft.util.Endpoint) StoreEngineOptions(com.alipay.sofa.jraft.rhea.options.StoreEngineOptions)

Example 7 with PlacementDriverOptions

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);
}
Also used : RegionRouteTableOptions(com.alipay.sofa.jraft.rhea.options.RegionRouteTableOptions) RheaKVStoreOptions(com.alipay.sofa.jraft.rhea.options.RheaKVStoreOptions) PlacementDriverOptions(com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions)

Aggregations

PlacementDriverOptions (com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions)7 RheaKVStoreOptions (com.alipay.sofa.jraft.rhea.options.RheaKVStoreOptions)6 StoreEngineOptions (com.alipay.sofa.jraft.rhea.options.StoreEngineOptions)6 Endpoint (com.alipay.sofa.jraft.util.Endpoint)4 Configuration (com.alipay.sofa.jraft.conf.Configuration)2 DefaultRheaKVStore (com.alipay.sofa.jraft.rhea.client.DefaultRheaKVStore)2 RheaKVStore (com.alipay.sofa.jraft.rhea.client.RheaKVStore)2 BatchingOptions (com.alipay.sofa.jraft.rhea.options.BatchingOptions)2 PeerId (com.alipay.sofa.jraft.entity.PeerId)1 StoreEngine (com.alipay.sofa.jraft.rhea.StoreEngine)1 FakePlacementDriverClient (com.alipay.sofa.jraft.rhea.client.pd.FakePlacementDriverClient)1 PlacementDriverClient (com.alipay.sofa.jraft.rhea.client.pd.PlacementDriverClient)1 RemotePlacementDriverClient (com.alipay.sofa.jraft.rhea.client.pd.RemotePlacementDriverClient)1 RegionRouteTableOptions (com.alipay.sofa.jraft.rhea.options.RegionRouteTableOptions)1 RpcOptions (com.alipay.sofa.jraft.rhea.options.RpcOptions)1 AffinityNamedThreadFactory (com.alipay.sofa.jraft.rhea.util.concurrent.AffinityNamedThreadFactory)1 NamedThreadFactory (com.alipay.sofa.jraft.rhea.util.concurrent.NamedThreadFactory)1 TaskDispatcher (com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.TaskDispatcher)1 ThreadFactory (java.util.concurrent.ThreadFactory)1