Jump to: navigation, search

Difference between revisions of "Gyrex/Administrator Guide/Cloud"

(Node Management)
(Cloud)
Line 1: Line 1:
 
== Cloud ==
 
== Cloud ==
 
The Gyrex cloud functionality is implemented based on [http://hadoop.apache.org/zookeeper/ ZooKeeper]. When running in development mode, an embedded ZooKeeper server is started automatically so you don't have to configure anything at all. For production environments we highly recommend running a standalone ZooKeeper ensemble. Please have a look at the [http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html ZooKeeper Administrator's Guide] for details on how to setup your own ensemble.
 
The Gyrex cloud functionality is implemented based on [http://hadoop.apache.org/zookeeper/ ZooKeeper]. When running in development mode, an embedded ZooKeeper server is started automatically so you don't have to configure anything at all. For production environments we highly recommend running a standalone ZooKeeper ensemble. Please have a look at the [http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html ZooKeeper Administrator's Guide] for details on how to setup your own ensemble.
 +
 +
=== Connect to ZooKeeper ===
 +
The first step is to connect each node with the ZooKeeper cluster. This can be done using the OSGi console or the Gyrex Admin UI.
 +
 +
''Connect a node to ZooKeeper:''
 +
<pre>
 +
osgi> cloud setConnectString &lt;zookeeper-connect-string&gt;
 +
[nodeId] (hostname)
 +
...
 +
osgi>
 +
</pre>
 +
 +
The <code>zookeeper-connect-string</code> can be any valid ZooKeeper connection string. In its simplest it's just a hostname or IP address.
  
 
=== Node Management ===
 
=== Node Management ===
Line 14: Line 27:
 
osgi> help
 
osgi> help
 
[...]
 
[...]
---Cloud Commands---
+
---CloudConsoleCommands---
 
cloud <cmd> [args]
 
cloud <cmd> [args]
approve nodeId
+
approve <NODEID> - approves a node
ls pending|approved
+
ls pending|approved|online - list nodes
retire nodeId
+
retire <NODEID> - retires a node
---ZooKeeper Commands---
+
setConnectString <CONNECTSTRING> - sets the connect string for the local node
 +
setOffline - sets the current node offline
 +
setOnline - sets the current node on-line
 +
setTags <nodeId> [-t <tag> [-t <tag>]] - set tags for a node
 +
---ZooKeeperConsoleCommands---
 
zk <cmd> [args]
 
zk <cmd> [args]
create [-s] [-e] path [data]
+
create <PATH> - creates a path in ZK
get path
+
get <PATH> - prints the content of the node at the specified path as a string
ls [-r] path
+
ls <PATH> [-r] - lists the specified path
rm [-r] path
+
reconnect - reconnects the ZooKeeper gate
set path data
+
rm <PATH> [-r] - removes the specified path
stat path
+
set <PATH> - sets the content of the node at the specified path as a string
sync path
+
stat <PATH> - prints ZK stats of the specified path
 +
sync <PATH> - performs ZK sync on the specified path
 
[...]
 
[...]
 
osgi>
 
osgi>

Revision as of 12:16, 9 November 2012

Cloud

The Gyrex cloud functionality is implemented based on ZooKeeper. When running in development mode, an embedded ZooKeeper server is started automatically so you don't have to configure anything at all. For production environments we highly recommend running a standalone ZooKeeper ensemble. Please have a look at the ZooKeeper Administrator's Guide for details on how to setup your own ensemble.

Connect to ZooKeeper

The first step is to connect each node with the ZooKeeper cluster. This can be done using the OSGi console or the Gyrex Admin UI.

Connect a node to ZooKeeper:

osgi> cloud setConnectString <zookeeper-connect-string>
[nodeId] (hostname)
...
osgi>

The zookeeper-connect-string can be any valid ZooKeeper connection string. In its simplest it's just a hostname or IP address.

Node Management

An essential part of a cloud is node membership. Node membership in Gyrex is implemented by explicit approval of nodes. Each node has a unique identifier. Upon first start a new one is generated. It's also possible to manually set node ids. However, you need to ensure that node ids are unique. No two nodes with the same identifier are allows to join the cloud.

After a new node joins a cloud it will be registered with a pending state. In this state the node is not allowed to participate in any cloud activity other than node registration. An administrator need to explicitly approve the node first. Once the node has been approved it will become online.

Tags may be assigned to nodes. They will play an important role when distributing functionality and responsibilities within your cloud.

Console Commands

Two commands are available in the Equinox OSGi console for managing and analyzing the cloud. They both come with a small syntax help

osgi> help
[...]
---CloudConsoleCommands---
	cloud <cmd> [args]
		approve <NODEID> - approves a node
		ls pending|approved|online - list nodes
		retire <NODEID> - retires a node
		setConnectString <CONNECTSTRING> - sets the connect string for the local node
		setOffline - sets the current node offline
		setOnline - sets the current node on-line
		setTags <nodeId> [-t <tag> [-t <tag>]] - set tags for a node
---ZooKeeperConsoleCommands---
	zk <cmd> [args]
		create <PATH> - creates a path in ZK
		get <PATH> - prints the content of the node at the specified path as a string
		ls <PATH> [-r] - lists the specified path
		reconnect - reconnects the ZooKeeper gate
		rm <PATH> [-r] - removes the specified path
		set <PATH> - sets the content of the node at the specified path as a string
		stat <PATH> - prints ZK stats of the specified path
		sync <PATH> - performs ZK sync on the specified path
[...]
osgi>

List pending (unapproved) nodes:

osgi> cloud ls pending
[nodeId] (hostname)
...
osgi>

Approve a node:

osgi> cloud approve <nodeId>