Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for 
change notification.

The "GettingStarted_ZH" page has been changed by Luikore.
http://wiki.apache.org/cassandra/GettingStarted_ZH

--------------------------------------------------

New page:
== 简介 ==
Cassandra 是个高级话题, 就算她变得越来越好使,用户还是可能会对初体验感到畏惧。这篇文档目的是提供一些简单的指引,教会新用户如何安装 
Canssandra,最终架设起一个可用的集群(Cluster)。

== 第 0 步: 找到组织 ==
获取项目、发布、稳定性、臭虫和特性的最佳方式,是订阅用户邮件列表([[mailto:user-subscr...@cassandra.apache.org|subscription
 required]]) 和参与到 #cassandra 
[[http://webchat.freenode.net/?channels=#cassandra|IRC]] 频道。

<<Anchor(picking_a_version)>>

== 第一步: 选个版本 ==
任何时候都可以选择一堆不同的版本:

=== 稳定的发布 ===
Cassandra 的稳定发布版已被充分测试,不会有严重问题(或者问题已经被获悉并且写到文档中了)。如果你在建设一个产品环境,稳定版是你的选择。

你总能从这里找到最新稳定版的下载链接:[[http://cassandra.apache.org/download|website]]。

=== 测试版和发布候选 ===
Betas are prototype releases considered ready for user testing, and release 
candidates have the potential to become the next stable release. These releases 
represent the state-of-the-art so are often the best place to start, and since 
APIs and on-disk storage formats can change between major versions this can 
also save you from an upgrade. The testing and feedback is also highly 
appreciated.

=== Nightly 版本 ===
Nightly builds represent the current state of development as of the time of the 
build. They contain all of the previous day's new features, fixes, and newly 
introduced bugs. The only guarantee they come with is that they successfully 
build and the unit tests pass. Nightly builds are a handy way of testing recent 
changes, or accessing the latest features and fixes not found in beta or 
release candidates, but there is some risk of them being buggy.

The most recent nightly build can be downloaded 
[[http://hudson.zones.apache.org/hudson/job/Cassandra/lastSuccessfulBuild/artifact/cassandra/build/|here]].

=== Subversion ===
Cassandra 的 subversion 库是开发者活跃的地方。任何对贡献代码有兴趣的人都可以从 trunk 中检出代码。如果你在 subversion 
的代码中运行,一定要常常更新,并且订阅 
[[mailto:dev-subscr...@cassandra.apache.org?subject=subscribe|邮件列表]] 以获得最新的消息。

关于检出代码的指引可以在这里找到 [[http://cassandra.apache.org/download|website]]。

<<Anchor(running_a_single_node)>>

== 第二步:跑一个节点(机器) ==
Cassandra 往往以机器集群的方式部署,但是在单台机器上也能跑得很好。为避免一下就碰触到巨大的复杂系统,玩单机是入门良径。

现在还没有安装程序,最简单的方法就是从解压的目录<<FootNote(Users of Debian or Debian-based derivatives 
can install the latest stable release in package form, see DebianPackaging for 
details.)>> 或者 SVN 检出(参见: [[#picking_a_version|选择一个版本]])目录直接运行 
Canssandra。如果你下载的不是二进制版本,你需要先使用 ant 编译它。

发布版的样例设置 `conf/storage-conf.xml` 包含了一些比较推荐的默认值和注释,但是你要保证 `CommitLogDirectory` 和 
`DataFileDirectories` 都存在。 另外,最好也花点时间检查一下 `conf/log4j.properties`,确保配置中指定的目录都存在。

Some people running OS X have trouble getting Java 6 to work. If you've kept up 
with Apple's updates, Java 6 should already be installed (it comes in Mac OS X 
10.5 Update 1). Unfortunately, Apple does not default to using it. What you 
have to do is change your `JAVA_HOME` environment setting to 
`/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home` and add 
`/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin` to the 
beginning of your `PATH`.

And now for the moment of truth, start up Cassandra by invoking `bin/cassandra 
-f` from the command line<<FootNote(To learn more about controlling the 
behavior of startup scripts, see RunningCassandra.)>>. The service should start 
in the foreground and log gratuitously to standard-out. Assuming you don't see 
messages with scary words like "error", or "fatal", or anything that looks like 
a Java stack trace, then chances are you've succeeded. To be certain though, 
take some time to try out the examples in CassandraCli and ThriftInterface 
before moving on. Also, if you run into problems, Don't Panic, calmly proceed 
to [[#if_something_goes_wrong|If Something Goes Wrong]].

== 第三步:跑一个集群 ==
建设一个 Cassandra 集群 ''几乎'' 就是对每个节点重复 [[#running_a_single_node|第二步]]。 不过还是有一些例外。

Cassandra 的节点之间通过一种叫做 "八卦"(Gossip) 
的机制交流信息,为了让她们能“八”起来,需要先把至少已有集群中的一个节点介绍给新节点,这个过程称作“播种”(Seed)。
你可以自己选一些少数稳定的节点作为种子,但是没有很爽很快的方式去完成这件工作 …… 
你需要保证每个种子节点至少认识一个别的节点,别的节点也需要认识别的节点,如果落入鸡生蛋、蛋生鸡的循环就没完没了了。

除了“播种”外,你还需要设置 IP 接口,保证其他节点可以访问 `ListenAddress`,客户端机器可以访问 `ThriftAddress`。

当所有东西都配置完,节点也开始跑了,使用 `bin/nodetool` 工具去检验集群的状态。例如:

{{{
eev...@achilles:~$ bin/nodetool -host 98.139.220.175 ring
Address       Status     Load          Range                                    
  Ring
                                       169048975998562660269742699624378098572
98.139.220.175  Up         0.02 GB     14183696824377310051808173385764689249   
  |<--|
98.139.169.152  Up         0.4 GB      28356863910078205288614550619314017621   
  |   ^
98.139.220.176  Up         0.13 GB     42530828068625072228863933889289238187   
  |-->|
}}}
更多的集群机器的控制操作参见 [[Operations]]。

如果你没有足够多的机器去试验 Cassandra 集群,你可以访问 EC2 并尝试 [[Cassandra EC2]]。

== 第四步: 跑一堆集群——啊不,写你程序! ==
Cassandra 使用 [[http://incubator.apache.org/thrift/|Thrift]] 作为它的客户端接口 API。 
Cassandra 的主 API/RPC/Thrift 接口是 9160。 Thrift 
支持[[http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/|很多种编程语言的访问]],所以你可以只使用
 Thrift 来访问, 或者使用 [[http://wiki.apache.org/cassandra/ClientOptions|高级点的客户端]] 
来访问 Cassandra。 请参考 [[http://wiki.apache.org/thrift|Thrift wiki]], 
开卷有益。在动手之前还可以看看 ThriftExamples 中的 Cassandra 样例。

Cassandra 的主 API/RPC/Thrift 使用的端口是 9160。 不要和 JMX 端口弄混了哦!

找个演示程序看看也会很有帮助,例如 [[http://github.com/ericflo/twissandra|Twissandra]] (Python + 
Django) 。

<<Anchor(if_something_goes_wrong)>>

== 出岔子了! ==
If you followed the steps in this guide and failed to get up and running, we'd 
love to help. Here's what we need.

 1. If you are running anything other than a stable release, please upgrade 
first and see if you can still reproduce the problem.
 1. Make sure debug logging is enabled (hint: `conf/log4j.properties`) and save 
a copy of the output.
 1. Search the [[http://news.gmane.org/gmane.comp.db.cassandra.user|mailing 
list archive]] and see if anyone has reported a similar problem and what, if 
any resolution they received.
 1. Ditto for the [[https://issues.apache.org/jira/browse/CASSANDRA|bug 
tracking system]].
 1. See if you can put together a unit test, script, or application that 
reproduces the problem.

Finally, post a message with all relevant details to the list 
([[mailto:user-subscr...@cassandra.apache.org|subscription required]]), or hop 
onto [[http://webchat.freenode.net/?channels=#cassandra|IRC]] (network 
irc.freenode.net, channel #cassandra) and let us know.

<<BR>> <<BR>>

----
'''Footnotes:'''

Reply via email to