use of org.apache.ignite.internal.client.GridClientConfiguration in project gridgain by gridgain.
the class CheckIndexInlineSizes method execute.
/**
* {@inheritDoc}
*/
@Override
public Object execute(GridClientConfiguration clientCfg, Logger log) throws Exception {
try (GridClient client = Command.startClient(clientCfg)) {
Set<GridClientNode> serverNodes = client.compute().nodes().stream().filter(SRV_NODES).collect(toSet());
Set<GridClientNode> supportedServerNodes = serverNodes.stream().filter(n -> n.supports(CHECK_INDEX_INLINE_SIZES)).collect(toSet());
Collection<UUID> serverNodeIds = F.transform(serverNodes, GridClientNode::nodeId);
Collection<UUID> supportedServerNodeIds = F.transform(supportedServerNodes, GridClientNode::nodeId);
CheckIndexInlineSizesResult res = client.compute().projection(supportedServerNodes).execute(CheckIndexInlineSizesTask.class.getName(), new VisorTaskArgument<>(supportedServerNodeIds, false));
Set<UUID> unsupportedNodes = serverNodeIds.stream().filter(n -> !supportedServerNodeIds.contains(n)).collect(toSet());
analyzeResults(log, unsupportedNodes, res);
}
return null;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project gridgain by gridgain.
the class DrAbstractRemoteSubCommand method execute0.
/**
*/
protected VisorResultDto execute0(GridClientConfiguration clientCfg, GridClient client) throws Exception {
GridClientCompute compute = client.compute();
Collection<GridClientNode> nodes = compute.nodes();
nodes.stream().filter(node -> !drControlUtilitySupported(node)).collect(toCollection(() -> nodesWithoutDrTasks));
List<UUID> nodeIds = nodes.stream().filter(DrAbstractRemoteSubCommand::drControlUtilitySupported).map(GridClientNode::nodeId).collect(toList());
if (F.isEmpty(nodeIds))
throw new GridClientDisconnectedException("Connectable nodes not found", null);
return compute.projection(DrAbstractRemoteSubCommand::drControlUtilitySupported).execute(visorTaskName(), new VisorTaskArgument<>(nodeIds, args.toVisorArgs(), false));
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project gridgain by gridgain.
the class PartitionReconciliation method partitionReconciliationCheck.
/**
* Prepares arguments, executes partition reconciliation task, prints logs and optionally fix inconsistency.
*
* @param client Client node to run initial task.
* @param clientCfg Client configuration.
* @param log Logger.
* @return Result of operation.
* @throws GridClientException If failed.
*/
private ReconciliationResult partitionReconciliationCheck(GridClient client, GridClientConfiguration clientCfg, Logger log) throws GridClientException {
VisorPartitionReconciliationTaskArg taskArg = new VisorPartitionReconciliationTaskArg(args.caches, args.fastCheck, args.repair, args.includeSensitive, args.locOutput, args.parallelism, args.batchSize, args.recheckAttempts, args.repairAlg, args.recheckDelay);
List<GridClientNode> unsupportedSrvNodes = client.compute().nodes().stream().filter(node -> !node.isClient()).filter(node -> !node.supports(IgniteFeatures.PARTITION_RECONCILIATION)).collect(Collectors.toList());
if (!unsupportedSrvNodes.isEmpty()) {
final String strErrReason = "Partition reconciliation was rejected. The node [id=%s, consistentId=%s] doesn't support this feature.";
List<String> errs = unsupportedSrvNodes.stream().map(n -> String.format(strErrReason, n.nodeId(), n.consistentId())).collect(toList());
print(new ReconciliationResult(new ReconciliationAffectedEntries(), new HashMap<>(), errs), log::info);
throw new VisorIllegalStateException("There are server nodes not supported partition reconciliation.");
} else {
ReconciliationResult res = executeTask(client, VisorPartitionReconciliationTask.class, taskArg, clientCfg);
print(res, log::info);
return res;
}
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project gridgain by gridgain.
the class BinaryConfigurationCustomSerializerSelfTest method testThinClientConnected.
/**
* Test that thin client will be able to connect to node with custom binary serializer and custom consistent ID.
*
* @throws Exception If failed.
*/
@Test
public void testThinClientConnected() throws Exception {
UUID nid = ignite(0).cluster().localNode().id();
GridClientConfiguration clnCfg = new GridClientConfiguration();
clnCfg.setProtocol(GridClientProtocol.TCP);
clnCfg.setServers(Collections.singleton("127.0.0.1:11211"));
clnCfg.setBalancer(new GridClientRoundRobinBalancer());
// Start client.
GridClient client = GridClientFactory.start(clnCfg);
// Execute some task.
client.compute().execute(VisorNodePingTask.class.getName(), new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false));
GridClientFactory.stop(client.id(), false);
}
Aggregations