2015-05-13 45 views
0

我想用嵌入模式爲我的應用程序設置一個Cassandra的簡單Titan實例。沒有Rexster,泰坦服務器或集羣涉及,我只是想在我的應用程序本地泰坦。我根據Titan文檔herehere配置了Titan。這似乎在Titan試圖在啓動時啓動cassandra時運行良好。如何配置嵌入Cassandra的泰坦?

問題是在整個文檔中引用了cassandra.yaml,但我找不到與Titan一起使用的此文件的示例。我找到的所有是Titan GitHub上的cassandra.yaml,但它包含很多變量引用(例如${cassandra.token}),我的cassandra實例顯然不知道如何處理它們。

基本上我要找的是一個cassandra.yaml,它可以很好地適用嵌入在Titan中的Cassandra實例。有人可以幫我嗎?

回答

1

也許你應該與卡桑德拉本身提供的cassandra.yaml開始:

https://github.com/apache/cassandra/blob/trunk/conf/cassandra.yaml

這將是免費的,從土衛六的任何變量或其他標記。

+0

是的,好主意。我試圖做到這一點,不幸的是,泰坦嵌入的卡桑德拉拒絕了該文件,聲稱其中存在「未知選項」。刪除它們之後,輝煌的結果是在Cassandra內部的某個地方出現了'NullPointerException'。我的猜測是,我的Cassandra版本不同於此配置文件的設計版本。我實際上以不同的方式解決它,請參閱下面的答案 – Alan47

1

經過大量的來回(以及大量的試驗和錯誤),我終於到達了一個工作配置。我這樣做的方式是從github下載titan-cassandra 0.3.0項目,並在其中找到cassandra.yaml。我不得不評論幾個參數,因爲titan-cassandra 0.5.4顯然不再接受它們。

它可能不完美(如果有人有進一步的建議,請告訴我),但至少它是有效的。這是一個cassandra.yaml兼容titan-cassnadra 0.5.4。在嵌入式模式下:

# Cassandra storage config YAML 

# NOTE: 
# See http://wiki.apache.org/cassandra/StorageConfiguration for 
# full explanations of configuration directives 
# /NOTE 

cluster_name: 'Test Cluster' 

initial_token: 

hinted_handoff_enabled: true 
max_hint_window_in_ms: 10800000 
hinted_handoff_throttle_in_kb: 1024 
max_hints_delivery_threads: 2 

authenticator: org.apache.cassandra.auth.AllowAllAuthenticator 
authorizer: org.apache.cassandra.auth.AllowAllAuthorizer 

partitioner: org.apache.cassandra.dht.RandomPartitioner 

data_file_directories: 
    - /tmp/cassandra/data 

commitlog_directory: /tmp/cassandra/commitlog 

disk_failure_policy: stop 

key_cache_size_in_mb: 
key_cache_save_period: 14400 
# key_cache_keys_to_save: 100 
row_cache_size_in_mb: 0 
row_cache_save_period: 0 
saved_caches_directory: /tmp/cassandra/saved_caches 

commitlog_sync: periodic 
commitlog_sync_period_in_ms: 10000 
commitlog_segment_size_in_mb: 32 

seed_provider: 
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider 
     parameters: 
      - seeds: "127.0.0.1" 

concurrent_reads: 32 
concurrent_writes: 32 

memtable_flush_queue_size: 4 

trickle_fsync: false 
trickle_fsync_interval_in_kb: 10240 


storage_port: 7000 

ssl_storage_port: 7001 

listen_address: localhost 

start_native_transport: false 
native_transport_port: 9042 

start_rpc: true 
rpc_address: localhost 
rpc_port: 9160 

rpc_keepalive: true 

rpc_server_type: sync 

thrift_framed_transport_size_in_mb: 15 

thrift_max_message_length_in_mb: 16 

incremental_backups: false 

snapshot_before_compaction: false 

auto_snapshot: true 

column_index_size_in_kb: 64 

in_memory_compaction_limit_in_mb: 64 
multithreaded_compaction: false 
compaction_throughput_mb_per_sec: 16 
compaction_preheat_key_cache: true 

read_request_timeout_in_ms: 10000 
range_request_timeout_in_ms: 10000 
write_request_timeout_in_ms: 10000 
truncate_request_timeout_in_ms: 60000 
request_timeout_in_ms: 10000 

cross_node_timeout: false 

endpoint_snitch: SimpleSnitch 
dynamic_snitch_update_interval_in_ms: 100 
dynamic_snitch_reset_interval_in_ms: 600000 
dynamic_snitch_badness_threshold: 0.1 

request_scheduler: org.apache.cassandra.scheduler.NoScheduler 

index_interval: 128 

server_encryption_options: 
    internode_encryption: none 
    keystore: conf/.keystore 
    keystore_password: cassandra 
    truststore: conf/.truststore 
    truststore_password: cassandra 

client_encryption_options: 
    enabled: false 
    keystore: conf/.keystore 
    keystore_password: cassandra 

internode_compression: all 

由於字符限制StackOverflow的答案,我不得不刪除在這個文件中的評論很多。如果您需要任何參數信息,請下載cassandra發行版並查看包含cassandra.yaml的詳細信息。