cratedb 3.2.0进行安装
Cratedb下载地址:https://cdn.crate.io/downloads/releases/nightly/
cratedb官方文档手册:https://crate.io/docs/crate/reference/en/latest/
1.安装java
安装java,确保版本在1.8以上
[root@localhost ~]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
2.创建crate用户
因为cratedb不能在root用户下启动,所以需要创建非root用户,我这里创建crate用户
[root@localhost /]# useradd crate
[root@localhost /]# passwd crate
密码和用户名一致
3.配置crate环境变量
[crate@localhost ~]$ more .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/usr/local/java/jdk1.8.0_151
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH
[crate@local
4./etc/security/limits.conf 修改和sysctl修改
在该文件最后面添加如下两项,然后退出重新登录
* hard nofile 65536
* soft nofile 65536
[root@localhost /]# sysctl -w vm.max_map_count=262144
5.安装python3
步骤省略,可以参考
http://blog.chinaunix.net/uid-77311-id-5787558.html
6.准备安装目录
[root@localhost ~]# cd /
[root@localhost /]# mkdir cratedb
7.解压安装
[root@localhost soft]# tar -xvf crate-3.2.0-201809190203-616c19f.tar.gz
[root@localhost soft]# mv crate-3.2.0-201809190203-616c19f /cratedb/crate-3.2.0
[root@localhost /]# chown -R crate.crate /cratedb
8.修改配置文件crate.in.sh(cratedb用户下修改)
配置文件路径为: /cratedb/crate-3.2.0/bin/crate.in.sh
在该配置文件最开始添加如下两项(根据机器实际情况配置):
CRATE_MIN_MEM=2g
CRATE_MAX_MEM=2g
9.修改配置文件
network.bind_host: 192.168.1.129 network.publish_host: 192.168.1.129 network.host: 192.168.1.129 auth.host_based.enabled: true auth: host_based: config: 0: user: crate address: 192.168.1.81 method: trust 99: method: password # When trust based authentication is used, the server just takes the username # provided by the client as is without further validation. The HTTP # implementation extracts the username from the standard HTTP Basic Authentication # (`Authorization: Basic ...`) request header. In case the `Authorization` header is not set, # a default username can be specified as follows: auth: trust: http_default_user: crate |
10.启动
注意不能在root下启动
[root@localhost /]# su - crate
[crate@localhost bin]$ cd /cratedb/crate-3.2.0/bin
[crate@localhost bin]$./crate -d ##表示后台启动
11.登陆
发现3.2.0版本没有crash后台登陆了,只能通过界面的方式登陆,在IE栏输入:
http://192.168.1.129:4200
安装crash
curl -o crash https://cdn.crate.io/downloads/releases/crash_standalone_latest
chmod +x crash
crash --host 192.168.1.129
这里如下需要设置address为本机的ip地址
[crate@localhost cratedb]$ ./crash --host 192.168.1.118 CONNECT OK cr> CREATE USER devtest WITH (password='123456'); CREATE OK, 1 row affected (0.491 sec) cr> GRANT DQL TO devtest; GRANT OK, 1 row affected (0.022 sec) cr> GRANT DDL TO devtest; GRANT OK, 1 row affected (0.010 sec) cr> GRANT DML TO devtest; GRANT OK, 1 row affected (0.011 sec)
--------------------------------------------------------------------
CREATE USER devtest WITH (password='123456');
#赋予权限
GRANT DQL TO devtest;
GRANT DDL TO devtest;
GRANT DML TO devtest;
创建普通用户之后,在ie浏览器里就可以输入账号密码登陆了