当前位置:Gxlcms > 数据库问题 > cratedb 4.2 发布了

cratedb 4.2 发布了

时间:2021-07-01 10:21:17 帮助过:15人阅读

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   

人气教程排行