Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/Stratio/Crossdata
Browse files Browse the repository at this point in the history
  • Loading branch information
mafernandez-stratio committed Dec 12, 2016
2 parents 5baea19 + 0b499c4 commit 96c33b3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
14 changes: 7 additions & 7 deletions docker/catalog-config.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash -xe
function jdbcCatalog() {
crossdata_core_catalog_jdbc_driver=$1:3306
crossdata_core_catalog_jdbc_driver=${1:-3306}
crossdata_core_catalog_jdbc_url=$2
crossdata_core_catalog_jdbc_name=$3
crossdata_core_catalog_jdbc_user=$4
crossdata_core_catalog_jdbc_pass=$5
}

function zookeeperCatalog() {
crossdata_core_catalog_zookeeper_connectionString=$1:=localhost:2181
crossdata_core_catalog_zookeeper_connectionTimeout=$2:=15000
crossdata_core_catalog_zookeeper_sessionTimeout=$3:=60000
crossdata_core_catalog_zookeeper_retryAttempts=$4:=5
crossdata_core_catalog_zookeeper_retryInterval=$5:=10000
crossdata_core_catalog_zookeeper_connectionString=${1:-localhost:2181}
crossdata_core_catalog_zookeeper_connectionTimeout=${2:-15000}
crossdata_core_catalog_zookeeper_sessionTimeout=${3:-60000}
crossdata_core_catalog_zookeeper_retryAttempts=${4:-5}
crossdata_core_catalog_zookeeper_retryInterval=${5:-10000}
}


Expand All @@ -29,7 +29,7 @@ if [ "x$1x" != "xx" ]; then
zookeeperCatalog ${XD_CATALOG_ZOOKEEPER_CONNECTION_STRING} ${XD_CATALOG_ZOOKEEPER_CONNECTION_TIMEOUT} ${XD_CATALOG_ZOOKEEPER_SESSION_TIMEOUT} ${XD_CATALOG_ZOOKEEPER_RETRY_ATTEMPS} ${XD_CATALOG_ZOOKEEPER_RETRY_INTERVAL}
fi
if [ "x$2x" != "xx" ]; then
crossdata_core_catalog_prefix=$2:=crossdataCluster
crossdata_core_catalog_prefix=${2:-crossdataCluster}
fi
fi
fi
18 changes: 12 additions & 6 deletions docker/crossdata-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ function setHazelcastConfig() {
}

function setDriverConfig() {
export crossdata_driver_config_cluster_hosts=[$1:$2]
export crossdata_driver_config_cluster_hosts="[$1:$2]"
}

function standaloneConfig() {
AKKAIP="akka.tcp://CrossdataServerCluster@${DOCKER_HOST}:13420"
#TODO: Test instead of XD_SEED : CROSSDATA_SERVER_AKKA_CLUSTER_SEED_NODES
if [ -z ${XD_SEED} ]; then
if [ -z "$XD_SEED" ]; then
export CROSSDATA_SERVER_AKKA_CLUSTER_SEED_NODES=${AKKAIP}
else
SEED_IP="akka.tcp://CrossdataServerCluster@${XD_SEED}:13420"
Expand All @@ -34,12 +34,18 @@ function standaloneConfig() {
fi

#TODO: Check environment vars for hostname and bind hostname & ports
export CROSSDATA_SERVER_AKKA_REMOTE_NETTY_TCP_HOSTNAME=${DOCKER_HOST}
if [ -n "$CROSSDATA_SERVER_AKKA_REMOTE_NETTY_TCP_HOSTNAME" ]; then
setHazelcastConfig ${CROSSDATA_SERVER_AKKA_REMOTE_NETTY_TCP_HOSTNAME} 5701
else
export CROSSDATA_SERVER_AKKA_REMOTE_NETTY_TCP_HOSTNAME=${DOCKER_HOST}
fi

export CROSSDATA_SERVER_AKKA_REMOTE_NETTY_TCP_BIND_HOSTNAME=${DOCKER_HOST}
if [ -z ${XD_SEED} ]; then
crossdata_driver_config_cluster_hosts=[${DOCKER_HOST}:13420]

if [ -z "$XD_SEED" ]; then
crossdata_driver_config_cluster_hosts="\[${DOCKER_HOST}:13420\]"
else
crossdata_driver_config_cluster_hosts=[${DOCKER_HOST}:13420, ${XD_SEED}]
crossdata_driver_config_cluster_hosts="\[${DOCKER_HOST}:13420, ${XD_SEED}\]"
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ trait ServiceDiscoveryProvider {
s"${selfAddress.host.getOrElse("127.0.0.1")}:${selfAddress.port.getOrElse("13420")}"
}

private def getLocalMember: String =
s"${Try(hzConfig.getNetworkConfig.getJoin.getTcpIpConfig.getMembers.head).getOrElse("127.0.0.1:5701")}"
private def getLocalMember: String = {
val defaultAddr = "127.0.0.1"
val defaultPort = "5701"
hzConfig.getNetworkConfig.getJoin.getTcpIpConfig.getMembers.headOption flatMap {
case addrStr if addrStr.isEmpty => None
case addrStr if addrStr contains ':' => Some(addrStr)
case addrStr => Some(s"$addrStr:$defaultPort")
} getOrElse s"$defaultAddr:$defaultPort"
}

private def getLocalMember(hsp: HazelcastSessionProvider): String = {
val selfAddress = hsp.gelLocalMember.getAddress
Expand Down

0 comments on commit 96c33b3

Please sign in to comment.