Discuss New Concept,New Technic,New Tools, Including EAI,BPM,SOA,Tibco,IBM MQ,Tuxedo, Cloud,Hadoop,NoSQL,J2EE,Ruby,Scala,Python, Performance,Scalability,Distributed,HA, Social Network,Machine Learning.
Dec 292010
 

7. Two node cluster in one machine

Here use two nodes cluster in one machine as example, multiple nodes in multiple machine is the same story.

7.1.        Configuration

Create two directory rec_config1 and rec_config2, following is the structure:

7.1.1.   cluster.xml

Same content for two nodes:

<cluster>

<name>mycluster</name>

<server>

<id>0</id>

<host>9.33.92.233</host>

<http-port>8801</http-port>

<socket-port>6601</socket-port>

<admin-port>6602</admin-port>

<partitions>0, 1</partitions>

</server>

<server>

<id>1</id>

<!—host can be IP on another machine à

<host>9.33.92.233</host>

<http-port>8802</http-port>

<socket-port>6611</socket-port>

<admin-port>6612</admin-port>

<partitions>2, 3</partitions>

</server>

</cluster>

7.1.2.   server.properties

server1: for node 0

node.id=0

max.threads=100

############### DB options ######################

http.enable=true

socket.enable=true

jmx.enable=true

# BDB

bdb.write.transactions=false

bdb.flush.transactions=false

bdb.cache.size=100MB

server2: for node1

bdb.write.transactions=false

bdb.flush.transactions=false

bdb.cache.size=100MB

max.threads=100

http.enable=true

socket.enable=true

node.id=1

7.1.3.   store.xml

Same content for two nodes:

<stores>

<!– Note that “recommendation” store requires 2 reads and writes,

so to use this store you must have both nodes started and running –>

<store>

<name>recommendation</name>

<persistence>bdb</persistence>

<routing>client</routing>

<replication-factor>2</replication-factor>

<required-reads>2</required-reads>

<required-writes>2</required-writes>

<key-serializer>

<type>string</type>

<schema-info>utf8</schema-info>

</key-serializer>

<value-serializer>

<type>string</type>

<schema-info>utf8</schema-info>

</value-serializer>

</store>

<view>

<name>recommendation-view</name>

<view-of>recommendation</view-of>

<view-class>

voldemort.store.views.UpperCaseView

</view-class>

<value-serializer>

<type>string</type>

<schema-info>utf8</schema-info>

</value-serializer>

</view>

</stores>

7.2.        administrate

7.3.          Start cluster

7.3.1.   start node 1

Run command:

nohup ./bin/voldemort-server.sh config/rec_config1 &

7.3.2.   start node 2

Run command:

nohup ./bin/voldemort-server.sh config/rec_config2 &

7.4.          some command

henry@ranch:~/app/voldemort/bin$ ./voldemort-cluster-viewer.sh  –cluster /home/henry/app/voldemort/config/test_config1/config/cluster.xml –store-name test –stores /home/henry/app/voldemort/config/test_config1/config/stores.xml

henry@ranch:~/app/voldemort/bin$ ./voldemort-rebalance.sh –url tcp://9.33.92.233:6601 –cluster /home/henry/app/voldemort/config/test_config1/config/cluster.xml

log4j:WARN No appenders could be found for logger (voldemort.cluster.Node).

log4j:WARN Please initialize the log4j system properly.

7.5.        Develop

7.5.1.   Configuration

VOLDEMORT_BOOTSTRAP_URL=tcp://iheapp103.*.com:6601

VOLDEMORT_BOOTSTRAP_URL=tcp://iheapp103.*.com:6611

#max threads

VOLDEMORT_MAX_THREADS=50

#max total connections

VOLDEMORT_MAX_TOTAL_CONNECTIONS=100

#max bootstrap retries

VOLDEMORT_MAX_BOOTSTRAP_RETRIES=5

Add both sock server addresses to bootstrap url.

7.5.2.   code example

ClientConfig clientConfig=new ClientConfig();

clientConfig.setBootstrapUrls(VoldemortConfig.VOLDEMORT_BOOTSTRAP_URL);

clientConfig.setMaxThreads(VoldemortConfig.VOLDEMORT_MAX_THREADS);

clientConfig.setMaxTotalConnections(VoldemortConfig.VOLDEMORT_MAX_TOTAL_CONNECTIONS);

clientConfig.setMaxBootstrapRetries(VoldemortConfig.VOLDEMORT_MAX_BOOTSTRAP_RETRIES);

farmer

  One Response to “Voldemort Simple Guide (6) — Two nodes cluster in one machine”

  1. Voldemort Simple Guide (6) — Two nodes cluster in one machine ……

    [...]7. Two node cluster in one machine Here use two nodes cluster in one machine as example, multiple nodes in multiple machine is the same story. 7.1. Configuration Create two directory rec_config1 and rec_config2, following is the …[...]…

You must log in to post a comment.