Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/_docs/clustering/discovery-in-the-cloud.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ tab:C++[unsupported]
== Azure Blob Storage

Ignite supports automatic node discovery by utilizing Azure Blob Storage.
This mechanism is implemented in `TcpDiscoveryAzureBlobStorageIpFinder`.
This mechanism is implemented in `TcpDiscoveryAzureBlobStoreIpFinder`.
On start-up, each node registers its IP address in the storage and discovers other nodes by reading the storage.

IMPORTANT: To use `TcpDiscoveryAzureBlobStorageIpFinder` you must download and link:setup#enabling-modules[enable the 'ignite-azure-ext' extension].
IMPORTANT: To use `TcpDiscoveryAzureBlobStoreIpFinder` you must download and link:setup#enabling-modules[enable the 'ignite-azure-ext' extension].

Here is an example of how to configure Azure Blob Storage based IP finder:

Expand Down
37 changes: 37 additions & 0 deletions docs/_docs/code-snippets/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ignite.version>2.19.0-SNAPSHOT</ignite.version>
<ignite.extensions.version>1.0.0</ignite.extensions.version>
Comment thread
chesnokoff marked this conversation as resolved.
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -67,12 +68,48 @@
<artifactId>ignite-zookeeper</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-aws-ext</artifactId>
<version>${ignite.extensions.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-azure-ext</artifactId>
<version>${ignite.extensions.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<!-- ignite-cloud-ext is not published to Maven Central, so use the last released legacy artifact that still provides TcpDiscoveryCloudIpFinder. -->
<artifactId>ignite-cloud</artifactId>
<version>2.13.0</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it from extensions ? if so - why ver is hardcoded ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ignite-cloud was moved from the main Ignite repository to ignite-extensions as ignite-cloud-ext, but it looks like ignite-cloud-ext was never published to Maven Central. As a result, the only resolvable artifact containing TcpDiscoveryCloudIpFinder is the legacy ignite-cloud:2.13.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</dependency>
Comment thread
chesnokoff marked this conversation as resolved.
Comment thread
chesnokoff marked this conversation as resolved.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-gce-ext</artifactId>
<version>${ignite.extensions.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-kubernetes</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-zookeeper-ip-finder-ext</artifactId>
<version>${ignite.extensions.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ignite-opencensus</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-trace-zipkin</artifactId>
<version>0.31.1</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.ReadRepairStrategy;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.lang.IgniteFuture;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.azure.TcpDiscoveryAzureBlobStoreIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.elb.TcpDiscoveryElbIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder;
Expand Down Expand Up @@ -153,13 +154,13 @@ public static void azureBlobStorageExample() {
//tag::azureBlobStorage[]
TcpDiscoverySpi spi = new TcpDiscoverySpi();

TcpDiscoveryAzureBlobStorageIpFinder ipFinder = new TcpDiscoveryGoogleStorageIpFinder();
TcpDiscoveryAzureBlobStoreIpFinder ipFinder = new TcpDiscoveryAzureBlobStoreIpFinder();

finder.setAccountName("yourAccountName");
finder.setAccountKey("yourAccountKey");
finder.setAccountEndpoint("yourEndpoint");
ipFinder.setAccountName("yourAccountName");
ipFinder.setAccountKey("yourAccountKey");
ipFinder.setAccountEndpoint("yourEndpoint");

finder.setContainerName("yourContainerName");
ipFinder.setContainerName("yourContainerName");

spi.setIpFinder(ipFinder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
*/
package org.apache.ignite.snippets;

import javax.cache.Cache;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;
import javax.cache.Cache;

import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheInterceptor;
import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.cache.CacheInterceptor;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.resources.SessionContextProviderResource;
import org.apache.ignite.session.SessionContextProvider;
Expand Down Expand Up @@ -75,12 +76,22 @@ public class SessionContextCacheInterceptor implements CacheInterceptor<Integer,
return ret == null ? newVal : ret + entry.getKey();
}

/** */
@Override public void onAfterPut(Cache.Entry<Integer, String> entry) {
// No-op.
}

/** */
@Override public @Nullable IgniteBiTuple<Boolean, String> onBeforeRemove(Cache.Entry<Integer, String> entry) {
String ret = sesCtxPrv.getSessionContext().getAttribute("onBeforeRemove");

return new IgniteBiTuple<>(ret != null, entry.getValue());
}

/** */
@Override public void onAfterRemove(Cache.Entry<Integer, String> entry) {
// No-op.
}
}
//end::cache-interceptor[]

Expand All @@ -89,9 +100,9 @@ public void igniteSessContext() {
//tag::ignite-context[]
try (Ignite ign = Ignition.start(ignCfg)) {

Map<String, String> appAttrs = F.asMap("SESSION_ID", "1234");
Map<String, String> appAttrs = Map.of("SESSION_ID", "1234");

Ignite app = Ignite.withApplicationAttributes(appAttrs);
Ignite app = ign.withApplicationAttributes(appAttrs);

//Your code here...
}
Expand All @@ -113,4 +124,4 @@ public void jdbcSessContext() {
throw new RuntimeException(e);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
import javax.cache.event.CacheEntryEvent;
import javax.cache.event.CacheEntryListenerException;
import javax.cache.event.CacheEntryUpdatedListener;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteBinary;
import org.apache.ignite.Ignition;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.cache.query.Query;
Expand All @@ -47,6 +51,8 @@
import org.apache.ignite.client.ClientConnectionException;
import org.apache.ignite.client.ClientDisconnectListener;
import org.apache.ignite.client.ClientException;
import org.apache.ignite.client.ClientPartitionAwarenessMapper;
import org.apache.ignite.client.ClientPartitionAwarenessMapperFactory;
import org.apache.ignite.client.ClientTransaction;
import org.apache.ignite.client.ClientTransactions;
import org.apache.ignite.client.IgniteClient;
Expand Down Expand Up @@ -359,9 +365,11 @@ void partitionAwareness() throws Exception {
try (IgniteClient client = Ignition.startClient(cfg)) {
ClientCache<Integer, String> cache = client.cache("myCache");
// Put, get or remove data from the cache...
cache.put(0, "Hello, world!");
// The partition number can be specified with IndexQuery#setPartition(Integer) as well.
ScanQuery scanQuery = new ScanQuery().setPartition(part);

// Route the scan query to a node that owns the specified partition.
ScanQuery<Integer, String> scanQuery = new ScanQuery<Integer, String>().setPartition(0);

cache.query(scanQuery);
} catch (ClientException e) {
System.err.println(e.getMessage());
}
Expand All @@ -380,10 +388,10 @@ void partitionAwarenessWithCustomMapper() throws Exception {

return aff::partition;
}
})
});

try (IgniteClient client = Ignition.startClient(cfg)) {
ClientCache<Integer, String> cache = client.cache(PART_CUSTOM_AFFINITY_CACHE_NAME);
ClientCache<Integer, String> cache = client.cache("partitioned_custom_affinity_cache");
// Put, get or remove data from the cache, partition awarenes will be enabled.
}
catch (ClientException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/
package org.apache.ignite.snippets;

import java.io.File;
import java.util.Collections;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
Expand All @@ -28,7 +31,8 @@ void configuration() {
//tag::config[]
IgniteConfiguration cfg = new IgniteConfiguration();

File exSnpDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "ex_snapshots", true);
// Any directory the Ignite process can write to (example value).
File exSnpDir = new File("work", "ex_snapshots");
Comment thread
chesnokoff marked this conversation as resolved.

cfg.setSnapshotPath(exSnpDir.getAbsolutePath());
//end::config[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
package org.apache.ignite.snippets;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlTableFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.ignite.snippets;

import java.util.Collections;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.CacheConfiguration;
Expand Down
Loading
Loading