在/etc/profile裏面加上node
export CRATE_HEAP_SIZE=4g
crate.yml文件配置:sql
# 本配置文件適用crate 2.0.3版本,低版本配置略有不一樣 # 節點名稱 node.name: node1 # 集羣名稱,使用同一個名稱表示在同一個集羣中 cluster.name: einvoice gateway.expected_nodes: 3 gateway.recover_after_nodes: 2 gateway.recover_after_time: 5m # 高可用配置,集羣最小存活節點數 discovery.zen.minimum_master_nodes: 2 # 集羣互ping地址 discovery.zen.ping.unicast.hosts: - node1:4300 - node2:4300 - node3:4300 bootstrap.memory_lock : true path: conf: /home/hadmin/crate/config logs: /home/hadmin/data/crate/logs data: /home/hadmin/data/crate blobs.path: /home/hadmin/data/crate/crate_blob_data/disk # 這個是crate 快照備份的地址,暫時沒有配置 # Paths where Repositories of type fs may be created: #path.repo: /path/to/shared/fs,/other/shared/fs # 網絡綁定地址,默認綁定localhost,最好是綁定主機名 network.host: node1 # 開啓crate jdbc支持及訪問端口 psql.enabled: true psql.port: 5432
而後啓動bootstrap
./crate -dvim
日誌報錯bash
[2017-07-06T14:23:30,424][ERROR][o.e.b.BootstrapProxy ] [node1] node validation exception bootstrap checks failed max file descriptors [4096] for crate process is too low, increase to at least [65536] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
啓動出錯,文件描述符過低網絡
修改這個參數須要使用root登錄,查看當前該參數設置:app
[root@dscn1 logs]# ulimit -Hn 4096 [root@dscn1 logs]#
執行修改jvm
vim /etc/security/limits.conf
添加對hadmin用戶的設置,由於我要使用hadmin用戶啓動crate日誌
hadmin soft nofile 65536 hadmin hard nofile 65536 # 或者能夠直接設置爲所有 * soft nofile 65536 * hard nofile 65536
有人說,root的nofile要大於等於其它用戶的nofile,這個我不是很確定,那若是這樣的話,修改任一用戶的nofile後,都須要將root的nofile至少要大於等於這個值code
保存,退出用戶從新登陸,使配置生效,切換到hadmin用戶查看
[hadmin@dscn1 logs]$ ulimit -Hn 65536 [hadmin@dscn1 logs]$
已經修改完畢
下一個異常
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改文件
vi /etc/sysctl.conf
添加下列配置,我理解這個配置至關於設置jvm Xms=256m
vm.max_map_count=262144
並執行命令使之生效
sysctl -p
可能還會有這個異常
[2017-07-06T16:23:40,745][WARN ][o.e.b.JNANatives ] Unable to lock JVM Memory: error=12, reason=沒法分配內存 [2017-07-06T16:23:40,748][WARN ][o.e.b.JNANatives ] This can result in part of the JVM being swapped out. [2017-07-06T16:23:40,748][WARN ][o.e.b.JNANatives ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536 [2017-07-06T16:23:40,748][WARN ][o.e.b.JNANatives ] These can be adjusted by modifying /etc/security/limits.conf, for example: # allow user 'hadmin' mlockall hadmin soft memlock unlimited hadmin hard memlock unlimited
在/etc/security/limits.conf添加以上內容便可