Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atomix/atomix-vertx
Atomix Vert.x cluster manager.
https://github.com/atomix/atomix-vertx
Last synced: 3 months ago
JSON representation
Atomix Vert.x cluster manager.
- Host: GitHub
- URL: https://github.com/atomix/atomix-vertx
- Owner: atomix
- License: apache-2.0
- Created: 2015-10-04T00:52:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-27T19:19:27.000Z (about 6 years ago)
- Last Synced: 2024-08-04T01:08:03.658Z (6 months ago)
- Language: Java
- Size: 92.8 KB
- Stars: 24
- Watchers: 6
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- vertx-awesome - Atomix Cluster Manager - An [Atomix](http://atomix.io) based cluster manager implementation for Vert.x 3. (Cluster Managers)
README
# Atomix Vert.x Cluster Manager
This project provides a cluster manager for [Vert.x](http://vertx.io) built on the [Atomix](http://atomix.io) distributed systems framework.
### Installation
Add the Maven dependency to your `pom.xml`:
```xml
io.atomix.vertx
atomix-vertx
1.0.0-SNAPSHOT```
### Usage
To use the Atomix cluster manager, simply add the Atomix jar to your classpath. By default, when the Atomix cluster manager is loaded it will load the Atomix configuration from an `atomix.conf` file on the classpath.
`atomix.conf`
```
cluster {
memberId: member-1
host: 192.168.10.2
port: 5679multicast.enabled: true
discovery {
type: multicast
broadcastInterval: 1s
}protocol {
type: swim
broadcastUpdates: true
probeInterval: 1s
failureTimeout: 5s
}
}managementGroup {
type: raft
partitions: 1
members: [member-1, member-2, member-3]
}partitionGroups.data {
type: primary-backup
partitions: 32
}
```A complete configuration reference can be found [on the website](https://atomix.io/docs/latest/user-manual/configuration/reference/).
```java
ClusterManager clusterManager = new AtomixClusterManager();
```You can also provide a custom configuration file by passing the file name to the `AtomixClusterManager` constructor.
```java
ClusterManager clusterManager = new AtomixClusterManager("my.conf");
```To use the `AtomixClusterManager` programmatically, construct an `Atomix` instance and pass it to the constructor.
```java
Atomix atomix = Atomix.builder()
.withMemberId("member-1")
.withHost("192.168.10.2")
.withPort(5679)
.withMulticastEnabled()
.withMembershipProvider(MulticastDiscoveryProvider.builder()
.withBroadcastInterval(Duration.ofSeconds(1))
.build())
.withMembershipProtocol(SwimMembershipProtocol.builder()
.withBroadcastUpdates(true)
.withProbeInterval(Duration.ofSeconds(1))
.withFailureTimeout(Duration.ofSeconds(5))
.build())
.withManagementGroup(RaftPartitionGroup.builder()
.withNumPartitions(1)
.withMembers("member-1", "member-2", "member-3")
.build())
.withPartitionGroups(PrimaryBackupPartitionGroup.builder("data")
.withNumPartitions(32)
.build())
.build();ClusterManager clusterManager = new AtomixClusterManager(atomix);
```Once the cluster manager has been constructed, configure Vert.x to use the Atomix cluster manager and start a clustered instance.
```java
// Configure the Vert.x cluster manager and create a new clustered Vert.x instance
VertxOptions options = new VertxOptions().setClusterManager(manager);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
```See the [Atomix website](http://atomix.io) for more information on configuring Atomix clusters.