org.apache.ratis.rpc.SupportedRpcType Java Examples
The following examples show how to use
org.apache.ratis.rpc.SupportedRpcType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RatisPipelineUtils.java From hadoop-ozone with Apache License 2.0 | 6 votes |
/** * Sends ratis command to destroy pipeline on the given datanode. * * @param dn - Datanode on which pipeline needs to be destroyed * @param pipelineID - ID of pipeline to be destroyed * @param ozoneConf - Ozone configuration * @param grpcTlsConfig - grpc tls configuration * @throws IOException */ static void destroyPipeline(DatanodeDetails dn, PipelineID pipelineID, ConfigurationSource ozoneConf, GrpcTlsConfig grpcTlsConfig) throws IOException { final String rpcType = ozoneConf .get(ScmConfigKeys.DFS_CONTAINER_RATIS_RPC_TYPE_KEY, ScmConfigKeys.DFS_CONTAINER_RATIS_RPC_TYPE_DEFAULT); final RetryPolicy retryPolicy = RatisHelper.createRetryPolicy(ozoneConf); final RaftPeer p = RatisHelper.toRaftPeer(dn); try(RaftClient client = RatisHelper .newRaftClient(SupportedRpcType.valueOfIgnoreCase(rpcType), p, retryPolicy, grpcTlsConfig, ozoneConf)) { client.groupRemove(RaftGroupId.valueOf(pipelineID.getId()), true, p.getId()); } }
Example #2
Source File: XceiverClientRatis.java From hadoop-ozone with Apache License 2.0 | 5 votes |
public static XceiverClientRatis newXceiverClientRatis( org.apache.hadoop.hdds.scm.pipeline.Pipeline pipeline, ConfigurationSource ozoneConf, X509Certificate caCert) { final String rpcType = ozoneConf .get(ScmConfigKeys.DFS_CONTAINER_RATIS_RPC_TYPE_KEY, ScmConfigKeys.DFS_CONTAINER_RATIS_RPC_TYPE_DEFAULT); final RetryPolicy retryPolicy = RatisHelper.createRetryPolicy(ozoneConf); final GrpcTlsConfig tlsConfig = RatisHelper.createTlsClientConfig(new SecurityConfig(ozoneConf), caCert); return new XceiverClientRatis(pipeline, SupportedRpcType.valueOfIgnoreCase(rpcType), retryPolicy, tlsConfig, ozoneConf); }
Example #3
Source File: XceiverServerRatis.java From hadoop-ozone with Apache License 2.0 | 5 votes |
private RpcType setRpcType(RaftProperties properties) { final String rpcType = conf.get( OzoneConfigKeys.DFS_CONTAINER_RATIS_RPC_TYPE_KEY, OzoneConfigKeys.DFS_CONTAINER_RATIS_RPC_TYPE_DEFAULT); final RpcType rpc = SupportedRpcType.valueOfIgnoreCase(rpcType); RaftConfigKeys.Rpc.setType(properties, rpc); return rpc; }
Example #4
Source File: RatisHelper.java From hadoop-ozone with Apache License 2.0 | 5 votes |
@SuppressWarnings("checkstyle:ParameterNumber") private static RaftClient newRaftClient(RpcType rpcType, RaftPeerId leader, RaftGroup group, RetryPolicy retryPolicy, GrpcTlsConfig tlsConfig, ConfigurationSource ozoneConfiguration) { if (LOG.isTraceEnabled()) { LOG.trace("newRaftClient: {}, leader={}, group={}", rpcType, leader, group); } final RaftProperties properties = new RaftProperties(); RaftConfigKeys.Rpc.setType(properties, rpcType); // Set the ratis client headers which are matching with regex. createRaftClientProperties(ozoneConfiguration, properties); RaftClient.Builder builder = RaftClient.newBuilder() .setRaftGroup(group) .setLeaderId(leader) .setProperties(properties) .setRetryPolicy(retryPolicy); // TODO: GRPC TLS only for now, netty/hadoop RPC TLS support later. if (tlsConfig != null && rpcType == SupportedRpcType.GRPC) { builder.setParameters(GrpcFactory.newRaftParameters(tlsConfig)); } return builder.build(); }
Example #5
Source File: Client.java From ratis with Apache License 2.0 | 5 votes |
@Override public void run() throws Exception { int raftSegmentPreallocatedSize = 1024 * 1024 * 1024; RaftProperties raftProperties = new RaftProperties(); RaftConfigKeys.Rpc.setType(raftProperties, SupportedRpcType.GRPC); GrpcConfigKeys.setMessageSizeMax(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.Appender.setBufferByteLimit(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.setWriteBufferSize(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.setPreallocatedSize(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.setSegmentSizeMax(raftProperties, SizeInBytes.valueOf(1 * 1024 * 1024 * 1024)); RaftServerConfigKeys.Log.setMaxCachedSegmentNum(raftProperties, 2); RaftClientConfigKeys.Rpc.setRequestTimeout(raftProperties, TimeDuration.valueOf(50000, TimeUnit.MILLISECONDS)); RaftClientConfigKeys.Async.setSchedulerThreads(raftProperties, 10); RaftClientConfigKeys.Async.setMaxOutstandingRequests(raftProperties, 1000); final RaftGroup raftGroup = RaftGroup.valueOf(RaftGroupId.valueOf(ByteString.copyFromUtf8(raftGroupId)), parsePeers(peers)); RaftClient.Builder builder = RaftClient.newBuilder().setProperties(raftProperties); builder.setRaftGroup(raftGroup); builder.setClientRpc(new GrpcFactory(new Parameters()).newRaftClientRpc(ClientId.randomId(), raftProperties)); RaftClient client = builder.build(); operation(client); }
Example #6
Source File: Client.java From incubator-ratis with Apache License 2.0 | 5 votes |
@Override public void run() throws Exception { int raftSegmentPreallocatedSize = 1024 * 1024 * 1024; RaftProperties raftProperties = new RaftProperties(); RaftConfigKeys.Rpc.setType(raftProperties, SupportedRpcType.GRPC); GrpcConfigKeys.setMessageSizeMax(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.Appender.setBufferByteLimit(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.setWriteBufferSize(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.setPreallocatedSize(raftProperties, SizeInBytes.valueOf(raftSegmentPreallocatedSize)); RaftServerConfigKeys.Log.setSegmentSizeMax(raftProperties, SizeInBytes.valueOf(1 * 1024 * 1024 * 1024)); RaftServerConfigKeys.Log.setSegmentCacheNumMax(raftProperties, 2); RaftClientConfigKeys.Rpc.setRequestTimeout(raftProperties, TimeDuration.valueOf(50000, TimeUnit.MILLISECONDS)); RaftClientConfigKeys.Async.setOutstandingRequestsMax(raftProperties, 1000); final RaftGroup raftGroup = RaftGroup.valueOf(RaftGroupId.valueOf(ByteString.copyFromUtf8(getRaftGroupId())), getPeers()); RaftClient.Builder builder = RaftClient.newBuilder().setProperties(raftProperties); builder.setRaftGroup(raftGroup); builder.setClientRpc(new GrpcFactory(new Parameters()).newRaftClientRpc(ClientId.randomId(), raftProperties)); RaftClient client = builder.build(); operation(client); }
Example #7
Source File: NettyRpcService.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.NETTY; }
Example #8
Source File: MiniRaftClusterWithNetty.java From ratis with Apache License 2.0 | 4 votes |
@Override public MiniRaftClusterWithNetty newCluster(String[] ids, RaftProperties prop) { RaftConfigKeys.Rpc.setType(prop, SupportedRpcType.NETTY); return new MiniRaftClusterWithNetty(ids, prop); }
Example #9
Source File: NettyFactory.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.NETTY; }
Example #10
Source File: MiniRaftClusterWithNetty.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public MiniRaftClusterWithNetty newCluster(String[] ids, RaftProperties prop) { RaftConfigKeys.Rpc.setType(prop, SupportedRpcType.NETTY); return new MiniRaftClusterWithNetty(ids, prop); }
Example #11
Source File: HadoopFactory.java From ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.HADOOP; }
Example #12
Source File: HadoopRpcService.java From ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.HADOOP; }
Example #13
Source File: MiniRaftClusterWithHadoopRpc.java From ratis with Apache License 2.0 | 4 votes |
public MiniRaftClusterWithHadoopRpc newCluster( String[] ids, RaftProperties prop, Configuration conf) { RaftConfigKeys.Rpc.setType(prop, SupportedRpcType.HADOOP); HadoopConfigKeys.Ipc.setAddress(conf, "0.0.0.0:0"); return new MiniRaftClusterWithHadoopRpc(ids, prop, conf); }
Example #14
Source File: GrpcFactory.java From ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.GRPC; }
Example #15
Source File: GrpcService.java From ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.GRPC; }
Example #16
Source File: MiniRaftClusterWithGrpc.java From ratis with Apache License 2.0 | 4 votes |
@Override public MiniRaftClusterWithGrpc newCluster( String[] ids, RaftProperties prop) { RaftConfigKeys.Rpc.setType(prop, SupportedRpcType.GRPC); return new MiniRaftClusterWithGrpc(ids, prop); }
Example #17
Source File: NettyRpcService.java From ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.NETTY; }
Example #18
Source File: NettyFactory.java From ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.NETTY; }
Example #19
Source File: MiniRaftClusterWithGrpc.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public MiniRaftClusterWithGrpc newCluster( String[] ids, RaftProperties prop) { RaftConfigKeys.Rpc.setType(prop, SupportedRpcType.GRPC); return new MiniRaftClusterWithGrpc(ids, prop); }
Example #20
Source File: GrpcService.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.GRPC; }
Example #21
Source File: GrpcFactory.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.GRPC; }
Example #22
Source File: MiniRaftClusterWithHadoopRpc.java From incubator-ratis with Apache License 2.0 | 4 votes |
public MiniRaftClusterWithHadoopRpc newCluster( String[] ids, RaftProperties prop, Configuration conf) { RaftConfigKeys.Rpc.setType(prop, SupportedRpcType.HADOOP); HadoopConfigKeys.Ipc.setAddress(conf, "0.0.0.0:0"); return new MiniRaftClusterWithHadoopRpc(ids, prop, conf); }
Example #23
Source File: HadoopRpcService.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.HADOOP; }
Example #24
Source File: HadoopFactory.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public SupportedRpcType getRpcType() { return SupportedRpcType.HADOOP; }
Example #25
Source File: TestOzoneContainerRatis.java From hadoop-ozone with Apache License 2.0 | 4 votes |
@Test public void testBothGetandPutSmallFileRatisGrpc() throws Exception { runTestBothGetandPutSmallFileRatis(SupportedRpcType.GRPC, 1); runTestBothGetandPutSmallFileRatis(SupportedRpcType.GRPC, 3); }
Example #26
Source File: TestOzoneContainerRatis.java From hadoop-ozone with Apache License 2.0 | 4 votes |
@Test public void testBothGetandPutSmallFileRatisNetty() throws Exception { runTestBothGetandPutSmallFileRatis(SupportedRpcType.NETTY, 1); runTestBothGetandPutSmallFileRatis(SupportedRpcType.NETTY, 3); }
Example #27
Source File: TestOzoneContainerRatis.java From hadoop-ozone with Apache License 2.0 | 4 votes |
@Test public void testOzoneContainerViaDataNodeRatisNetty() throws Exception { runTestOzoneContainerViaDataNodeRatis(SupportedRpcType.NETTY, 1); runTestOzoneContainerViaDataNodeRatis(SupportedRpcType.NETTY, 3); }
Example #28
Source File: TestOzoneContainerRatis.java From hadoop-ozone with Apache License 2.0 | 4 votes |
@Test public void testOzoneContainerViaDataNodeRatisGrpc() throws Exception { runTestOzoneContainerViaDataNodeRatis(SupportedRpcType.GRPC, 1); runTestOzoneContainerViaDataNodeRatis(SupportedRpcType.GRPC, 3); }
Example #29
Source File: TestRatisManager.java From hadoop-ozone with Apache License 2.0 | 4 votes |
@Test public void testTestRatisManagerNetty() throws Exception { runTestRatisManager(SupportedRpcType.NETTY); }
Example #30
Source File: TestRatisManager.java From hadoop-ozone with Apache License 2.0 | 4 votes |
@Test public void testTestRatisManagerGrpc() throws Exception { runTestRatisManager(SupportedRpcType.GRPC); }