码迷,mamicode.com
首页 > 数据库 > 详细

cratedb 4.2 发布了

时间:2020-08-29 15:12:58      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:nod   ons   支持   数据   函数   ble   number   expected   https   

cratedb 4.2 已经发布了,从changelogs 可以看到还是有比较多的更新的,比如pg 协议更好的兼容(更好的支持bi以及数据分析工具)
同时提供了更好的pg内部结构的暴露(还是方便数据分析工具的使用),同时替换nashorn 为graalvm 的js 引擎(更好的js 特性支持)
同时也提供了很多更好的内置函数,还是很不错的

一个简单docker-compose 运行说明

  • docker-compose 文件
 
version: "3"
services:
  crate1:
    image: dockerimage.yonyou.com/cratedb/crate:4.2.3
    volumes:
    - "./cratedb/data1:/data"
    - "./cratedb/1.yaml:/crate/config/crate.yml"
    ports:
    - "4200:4200"
    - "4300:4300"
    - "5432:5432"
  crate2:
    image: dockerimage.yonyou.com/cratedb/crate:4.2.3
    volumes:
    - "./cratedb/data2:/data"
    - "./cratedb/2.yaml:/crate/config/crate.yml"
    ports:
    - "4201:4200"
    - "4301:4300"
    - "5433:5432"
  crate3:
    image: dockerimage.yonyou.com/cratedb/crate:4.2.3
    volumes:
    - "./cratedb/data3:/data"
    - "./cratedb/3.yaml:/crate/config/crate.yml"
    ports:
    - "4202:4200"
    - "4302:4300"
    - "5434:5432"

1.yaml:

cluster.name: cratecluster
node.name: crate1
node.master: true
node.data: true
http.port: 4200
psql.port: 5432
transport.tcp.port: 4300
discovery.seed_hosts: ["crate1"]
cluster.initial_master_nodes: ["crate1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
gateway.expected_nodes: 3
gateway.recover_after_nodes: 2
gateway.recover_after_time: 5m
network.host: _local_,_site_
path.logs: /data/log
path.data: /data/data
blobs.path: /data/blobs

2.yaml:

cluster.name: cratecluster
node.name: crate2
node.master: false
node.data: true
http.port: 4200
psql.port: 5432
transport.tcp.port: 4300
discovery.seed_hosts: ["crate1"]
cluster.initial_master_nodes: ["crate1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
gateway.expected_nodes: 3
gateway.recover_after_nodes: 2
gateway.recover_after_time: 5m
network.host: _local_,_site_
path.logs: /data/log
path.data: /data/data
blobs.path: /data/blobs

3.yaml:

cluster.name: cratecluster
node.name: crate3
node.master: false
node.data: true
http.port: 4200
psql.port: 5432
transport.tcp.port: 4300
discovery.seed_hosts: ["crate1"]
cluster.initial_master_nodes: ["crate1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: _local_,_site_
gateway.expected_nodes: 3
gateway.recover_after_nodes: 2
gateway.recover_after_time: 5m
path.logs: /data/log
path.data: /data/data
blobs.path: /data/blobs
 
  • 代码调用
    pacakge.json:
 
{
  "name": "knex-crate-db",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "knex": "^0.21.5",
    "pg": "^8.3.2"
  },
  "scripts": {
    "app": "tsc && node dist/app.js"
  }
}

app.ts:

import knex from "knex"
var client = knex({
    client: ‘pg‘,
    version: ‘7.2‘,
    connection: {
        host: ‘ip‘,
        user: ‘crate‘
    }
});
?
let users = client("doc.users").select("*")
users.then((data) => {
    console.log(data)
    // close 
    client.destroy(function () {
        console.log(JSON.stringify(arguments))
    })
})

参考资料

https://crate.io/docs/crate/reference/en/latest/appendices/release-notes/4.2.0.html
https://github.com/knex/knex
https://github.com/brianc/node-postgres

cratedb 4.2 发布了

标签:nod   ons   支持   数据   函数   ble   number   expected   https   

原文地址:https://www.cnblogs.com/rongfengliang/p/13563132.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!