Hatena::ブログ(Diary)

おおたに6号機blog このページをアンテナに追加 RSSフィード

2010-03-31(水)

[][][]Cassandra-tools 01:46 Cassandra-toolsを含むブックマーク

Cassandra-toolsは、開発時にCassandraの状況を監視するツールです.

どのような設定になっており、どのようなデータが入っているかをURLコマンドラインや、

ブラウザアドレスバーに打ち込めば即座に確認できます.


たとえば、

http://localhost:8090/cassandra-tools/show/keyspace/Keyspace1


のように打つと、

{Super1={CompareSubcolumnsWith=org.apache.cassandra.db.marshal.BytesType,

CompareWith=org.apache.cassandra.db.marshal.BytesType, Desc=Keyspace1.Super1

Column Family Type: Super

Columns Sorted By: org.apache.cassandra.db.marshal.BytesType@1532fc, Type=Super},

......

Authors={CompareWith=org.apache.cassandra.db.marshal.BytesType, Desc=Keyspace1.Authors

Column Family Type: Standard

Columns Sorted By: org.apache.cassandra.db.marshal.BytesType@189c12a, Type=Standard}

}


のようにKeyspace1のカラムファミリ情報が取得できたりします.



また、どのようなKeyspaceが現状あるかだけ知りたい場合は、


http://localhost:8090/cassandra-tools/show/keyspaces/


のようにすれば、現状存在するKeyspaceを取得できます.


とりあえずこんな感じの機能をT2でさっくり作って見ました.


@Page("/show")
public class ShowPage {

	public ShowPage() {
	}

        //for HTTP GET with /cassandra-tools/show/clusterName
	@GET
	@ActionPath
	public Navigation clusterName(@In CassandraClient client) {
		String clusterName = client.describeClusterName();
		return SimpleText.out(clusterName);
	}

        //for HTTP GET with /cassandra-tools/keyspace/*the keyspace you want to know here*
	@GET
	@ActionPath("/keyspace/{keyspace}")
	public Navigation keyspace(@Var("keyspace") String keyspace,
			@In CassandraClient client) {
		Map<String, Map<String, String>> keyspaces = client
				.describeKeyspace(keyspace);

		// TODO iterate and format each.
		return SimpleText.out(keyspaces.toString());
	}

        //for HTTP GET with /cassandra-tools/keyspaces/
	@GET
	@ActionPath
	public Navigation keyspaces(@In CassandraClient client) {
		Set<String> set = client.describeKeyspaces();
		// TODO iterate and format each.
		return SimpleText.out(set.toString());
	}

        //ring information
        //for HTTP GET with /cassandra-tools/ring/*the keyspace you want to know here*
	@GET
	@ActionPath("/ring/{keyspace}")
	public Navigation ring(@Var("keyspace") String keyspace,
			@In CassandraClient client) {
		List<TokenRange> rings = client.describeRing(keyspace);

		// TODO iterate and format each.
		return SimpleText.out(rings.toString());
	}

}

プラグインで補助機能を実装していますが、こんな感じでさっくり書いてます.表示部分は手抜きですが今後ということで.

CassandraClientはthriftのシンプルラッパーです.今後もうちょい機能は足します.

あ、@Inはt2 0.7で入る簡易インジェクト機能です.

というわけでもうちょっと機能を追加して、githubにでもあげようかと思います.

genegene 2010/04/13 15:39 こんにちは。
聞きたいことがありまして、よろしければお答えください。
T2 + Seasar2 + Doma の組み合わせを試しているのですが、
HOT deployができないのです。
Teeda + Seasar2 + Doma では、できることは確認できたので、
そもそもT2は HOT deployできない?
設定の問題?
というところで行き詰っています。
ちなみに、クライアントはFlex4で試しています。