Giter Site home page Giter Site logo

saarthakgupta / hazelcast-ranger-discovery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phaneesh/hazelcast-ranger-discovery

0.0 1.0 0.0 25 KB

A simple discovery SPI for hazelcast based on flipkart-ranger service discovery library

Java 100.00%

hazelcast-ranger-discovery's Introduction

Hazelcast Ranger Discovery Travis build status

This is a discovery strategy extension for Hazelcast to make discovery work on ranger. This library compiles only on Java 8.

Dependencies

  • ranger 0.6.2

Usage

Hazelcast Ranger Discovery provides a easy way to enable member discovery with elastic applications on docker & DCOS like environment where using a static host list or using multicast based discovery is not possible.

Build instructions

  • Clone the source:

    git clone github.com/phaneesh/hazelcast-ranger-discovery
    
  • Build

    mvn install
    

Maven Dependency

Use the following repository:

<repository>
    <id>clojars</id>
    <name>Clojars repository</name>
    <url>https://clojars.org/repo</url>
</repository>

Use the following maven dependency:

<dependency>
    <groupId>com.ranger.hazelcast.servicediscovery</groupId>
    <artifactId>hazelcast-ranger-discovery</artifactId>
    <version>4.2-1</version>
</dependency>

Using Hazelcast Ranger Discovery

Config config = new Config();
//This is important to enable the discovery strategy
config.setProperty("hazelcast.discovery.enabled", "true");
config.setProperty("hazelcast.discovery.public.ip.enabled", "true");
config.setProperty("hazelcast.socket.client.bind.any", "true");
config.setProperty("hazelcast.socket.bind.any", "true");
NetworkConfig networkConfig = config.getNetworkConfig();
JoinConfig joinConfig = networkConfig.getJoin();
joinConfig.getTcpIpConfig().setEnabled(false);
joinConfig.getMulticastConfig().setEnabled(false);
joinConfig.getAwsConfig().setEnabled(false);
DiscoveryConfig discoveryConfig = joinConfig.getDiscoveryConfig();
//Set the discovery strategy to RangerDiscoveryStrategy
DiscoveryStrategyConfig discoveryStrategyConfig = new DiscoveryStrategyConfig(new RangerDiscoveryStrategyFactory());
//Zookeeper connection string used by ranger
discoveryStrategyConfig.addProperty("zk-connection-string", testingCluster.getConnectString());
//Namespace that needs to be used by ranger for this service
discoveryStrategyConfig.addProperty("namespace", "hz_disco");
//Service name that needs to be used
discoveryStrategyConfig.addProperty("service-name", "hz_disco_test");
discoveryConfig.addDiscoveryStrategyConfig(discoveryStrategyConfig);
//Create the hazelcast instance
HazelcastInstance hazelcast = Hazelcast.newHazelcastInstance(config);

Note

If you are using hazelcast in applications deployed on DCOS; then you should set the following configuration for discovery to work

NetworkConfig networkConfig = config.getNetworkConfig();
networkConfig.setPublicAddress("<public ip address/host name>" +":" +"<public port>");

Example: (On DCOS + Marathon assuming hazelcast container port is set to 5701)

NetworkConfig networkConfig = config.getNetworkConfig();
networkConfig.setPublicAddress(System.getenv("HOST") +":" +System.getenv("PORT_5701"))

LICENSE

Copyright 2016 Phaneesh Nagaraja [email protected].

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

hazelcast-ranger-discovery's People

Contributors

phaneesh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.