Skip to content
Open

Rex #1756

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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# local files
cloudspanner/dependency-reduced-pom.xml
dump.rdb
redis.properties
tmp/

# ignore compiled byte code
target

Expand Down
3 changes: 2 additions & 1 deletion bin/bindings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ solr7:site.ycsb.db.solr7.SolrClient
tarantool:site.ycsb.db.TarantoolClient
tablestore:site.ycsb.db.tablestore.TableStoreClient
voltdb:site.ycsb.db.voltdb.VoltClient4
zookeeper:site.ycsb.db.zookeeper.ZKClient
zookeeper:site.ycsb.db.zookeeper.ZKClient
rex_store:site.ycsb.db.RexStoreClient
3 changes: 2 additions & 1 deletion bin/ycsb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ DATABASES = {
"solr7" : "site.ycsb.db.solr7.SolrClient",
"tarantool" : "site.ycsb.db.TarantoolClient",
"tablestore" : "site.ycsb.db.tablestore.TableStoreClient",
"zookeeper" : "site.ycsb.db.zookeeper.ZKClient"
"zookeeper" : "site.ycsb.db.zookeeper.ZKClient",
"rex_store" : "site.ycsb.db.RexStoreClient"
}

OPTIONS = {
Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ LICENSE file.
<module>rados</module>
<module>redis</module>
<module>rest</module>
<module>rex_store</module>
<module>riak</module>
<module>rocksdb</module>
<module>s3</module>
Expand All @@ -215,6 +216,9 @@ LICENSE file.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.16</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand Down
14 changes: 13 additions & 1 deletion redis/src/main/java/site/ycsb/db/RedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,19 @@ public void init() throws DBException {
boolean clusterEnabled = Boolean.parseBoolean(props.getProperty(CLUSTER_PROPERTY));
if (clusterEnabled) {
Set<HostAndPort> jedisClusterNodes = new HashSet<>();
jedisClusterNodes.add(new HostAndPort(host, port));

// jedisClusterNodes.add(new HostAndPort(host, port));

String clusterNodesProp = props.getProperty("redis.cluster.nodes");
if (clusterNodesProp == null) {
throw new DBException("Missing required property: redis.cluster.nodes");
}
String[] clusterNodes = clusterNodesProp.split(",");
for (String node : clusterNodes) {
String[] parts = node.split(":");
jedisClusterNodes.add(new HostAndPort(parts[0], Integer.parseInt(parts[1])));
}

jedis = new JedisCluster(jedisClusterNodes);
} else {
String redisTimeout = props.getProperty(TIMEOUT_PROPERTY);
Expand Down
54 changes: 54 additions & 0 deletions redis_cluster_launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Usage: ./setup_redis_cluster.sh <num_nodes> [base_port]
NUM_NODES=${1:-3}
BASE_PORT=${2:-7000}
BASE_DIR="tmp/redis-cluster"
REDIS_SERVER="redis-server"
REDIS_CLI="redis-cli"
PROPERTIES_FILE="redis.properties"

echo "Setting up $NUM_NODES Redis nodes starting from port $BASE_PORT..."

mkdir -p "$BASE_DIR"
CLUSTER_NODES=""

# Create directories, config files, and launch nodes
for ((i = 0; i < NUM_NODES; i++)); do
PORT=$((BASE_PORT + i))
NODE_DIR="$BASE_DIR/$PORT"
mkdir -p "$NODE_DIR"

cat > "$NODE_DIR/redis.conf" <<EOF
port $PORT
cluster-enabled yes
cluster-config-file nodes-$PORT.conf
cluster-node-timeout 5000
appendonly yes
dir $NODE_DIR
EOF

echo "Starting Redis node on port $PORT..."
$REDIS_SERVER "$NODE_DIR/redis.conf" &
CLUSTER_NODES+="localhost:$PORT,"
done

# Wait for startup
sleep 3

# Trim trailing comma
CLUSTER_NODES=${CLUSTER_NODES%,}

# Create the cluster
echo "Creating Redis cluster..."
yes yes | $REDIS_CLI --cluster create ${CLUSTER_NODES//,/ } --cluster-replicas 0

# Generate redis.properties
echo "Generating redis.properties file..."
cat > "$PROPERTIES_FILE" <<EOF
redis.cluster=true
redis.cluster.nodes=$CLUSTER_NODES
redis.timeout=2000
EOF

echo "Cluster setup complete. Ports used: $CLUSTER_NODES"
12 changes: 12 additions & 0 deletions redis_cluster_reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo "Forcefully killing all Redis server processes..."
pkill -9 redis-server

echo "Waiting briefly to ensure processes terminate..."
sleep 1

echo "Cleaning up Redis cluster data directories..."
rm -rf tmp/redis-cluster/*

echo "Teardown complete. Redis processes killed and data wiped."
38 changes: 38 additions & 0 deletions rex_store/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>site.ycsb</groupId>
<artifactId>binding-parent</artifactId>
<version>0.18.0-SNAPSHOT</version>
<relativePath>../binding-parent</relativePath>
</parent>

<artifactId>rex_store-binding</artifactId>
<name>Rex Store Binding</name>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>site.ycsb</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230227</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading