国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

cockroachDB部署使用

JaysonWang / 3056人閱讀

容器部署

容器部署

拉取鏡像
docker pull cockroachdb/cockroach:v2.0.1
創(chuàng)建網(wǎng)絡(luò)
docker network create -d bridge roachnet

查看網(wǎng)絡(luò)(不清楚為什么沒(méi)有docker0,或者docker0和eb330591e579的關(guān)系)

# docker network ls 

NETWORK ID          NAME                DRIVER              SCOPE
eb330591e579        bridge              bridge              local               
95d2d6473765        host                host                local               
8edade4ef56f        none                null                local               
7e50fa75c534        roachnet            bridge              local 
運(yùn)行容器
docker run -d --name=roach1  --hostname=roach1 --net=roachnet -p 26257:26257 -p 8080:8080 -v "${PWD}/cockroach-data/roach1:/cockroach/cockroach-data" cockroachdb/cockroach:v2.0.1 start --insecure

docker run -d --name=roach2 --hostname=roach2 --net=roachnet -v "${PWD}/cockroach-data/roach2:/cockroach/cockroach-data" cockroachdb/cockroach:v2.0.1 start --insecure --join=roach1

docker run -d --name=roach3 --hostname=roach3 --net=roachnet -v "${PWD}/cockroach-data/roach3:/cockroach/cockroach-data" cockroachdb/cockroach:v2.0.1 start --insecure --join=roach1

驗(yàn)證集群 bug 了
[root@log-test cockroach-data]# docker exec -it roach1 ./cockroach sql --insecure
# Welcome to the cockroach SQL interface.
# All statements must be terminated by a semicolon.
# To exit: CTRL + D.
#
# Server version: CockroachDB CCL v2.0.1 (x86_64-unknown-linux-gnu, built 2018/04/23 18:39:21, go1.10) (same version as client)
# Cluster ID: 0721d2db-a3a1-4a87-96f2-7b35ee4a4b86
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1b0abb7]

runtime stack:
runtime.throw(0x2485b32, 0x2a)
    /usr/local/go/src/runtime/panic.go:619 +0x81
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:372 +0x28e

goroutine 1 [syscall]:
non-Go function
    pc=0x1b0abb7
non-Go function
    pc=0x1b0ad81
non-Go function
    pc=0x1b0a344
non-Go function
    pc=0x72e5af
runtime.cgocall(0x1b0a300, 0xc420657820, 0x2480f4f)
    /usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0xc4206577d8 sp=0xc4206577a0 pc=0x6d60c4
github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit/unix._C2func_go_libedit_init(0x0, 0x7f5986e59210, 0xc4200ba438, 0x7f5986e54000, 0x7f5986e54280, 0x7f5986e54500, 0x0, 0x0, 0x0, 0x0)
    _cgo_gotypes.go:200 +0x5c fp=0xc420657820 sp=0xc4206577d8 pc=0x1aa10ac
github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit/unix.InitFiles.func3(0x0, 0x7f5986e59210, 0xc4200ba438, 0x7f5986e54000, 0x7f5986e54280, 0x7f5986e54500, 0x0, 0xc420657930, 0x16b03db, 0x274de80)
    /go/src/github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit/unix/editline_unix.go:93 +0x19e fp=0xc420657880 sp=0xc420657820 pc=0x1aa425e
github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit/unix.InitFiles(0x243bd49, 0x9, 0x1, 0xc4200ba000, 0xc4200ba008, 0xc4200ba048, 0x0, 0x0, 0x0)
    /go/src/github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit/unix/editline_unix.go:93 +0x482 fp=0xc4206579c8 sp=0xc420657880 pc=0x1aa2462
github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit.InitFiles(0x243bd49, 0x9, 0x6ff101, 0xc4200ba000, 0xc4200ba008, 0xc4200ba048, 0xc420000180, 0x2568c10, 0xc42003ca80)
    /go/src/github.com/cockroachdb/cockroach/vendor/github.com/knz/go-libedit/editline_unix.go:15 +0x63 fp=0xc420657a20 sp=0xc4206579c8 pc=0x1aa5dd3
github.com/cockroachdb/cockroach/pkg/cli.runInteractive(0xc420471900, 0x0, 0x0)
    /go/src/github.com/cockroachdb/cockroach/pkg/cli/sql.go:1062 +0x41a fp=0xc420657bf8 sp=0xc420657a20 pc=0x1aceb3a
github.com/cockroachdb/cockroach/pkg/cli.runTerm(0x3658dc0, 0xc420044400, 0x0, 0x1, 0x0, 0x0)
    /go/src/github.com/cockroachdb/cockroach/pkg/cli/sql.go:1179 +0x159 fp=0xc420657c50 sp=0xc420657bf8 pc=0x1acf349
github.com/cockroachdb/cockroach/pkg/cli.MaybeDecorateGRPCError.func1(0x3658dc0, 0xc420044400, 0x0, 0x1, 0x0, 0x0)
    /go/src/github.com/cockroachdb/cockroach/pkg/cli/error.go:39 +0x5a fp=0xc420657cc8 sp=0xc420657c50 pc=0x1ae4c9a
github.com/cockroachdb/cockroach/vendor/github.com/spf13/cobra.(*Command).execute(0x3658dc0, 0xc420044390, 0x1, 0x1, 0x3658dc0, 0xc420044390)
    /go/src/github.com/cockroachdb/cockroach/vendor/github.com/spf13/cobra/command.go:698 +0x46d fp=0xc420657d70 sp=0xc420657cc8 pc=0x1a727cd
github.com/cockroachdb/cockroach/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x3655460, 0x6, 0x0, 0xc420657ee8)
    /go/src/github.com/cockroachdb/cockroach/vendor/github.com/spf13/cobra/command.go:783 +0x2e4 fp=0xc420657ea0 sp=0xc420657d70 pc=0x1a72f44
github.com/cockroachdb/cockroach/vendor/github.com/spf13/cobra.(*Command).Execute(0x3655460, 0x18, 0xc420657f00)
    /go/src/github.com/cockroachdb/cockroach/vendor/github.com/spf13/cobra/command.go:736 +0x2b fp=0xc420657ed0 sp=0xc420657ea0 pc=0x1a72c3b
github.com/cockroachdb/cockroach/pkg/cli.Run(0xc4200a4160, 0x2, 0x2, 0xc4200b6010, 0xc420558000)
    /go/src/github.com/cockroachdb/cockroach/pkg/cli/cli.go:156 +0x6d fp=0xc420657ef8 sp=0xc420657ed0 pc=0x1aad83d
github.com/cockroachdb/cockroach/pkg/cli.Main()
    /go/src/github.com/cockroachdb/cockroach/pkg/cli/cli.go:51 +0x15d fp=0xc420657f78 sp=0xc420657ef8 pc=0x1aad3cd
main.main()
    /go/src/github.com/cockroachdb/cockroach/main.go:27 +0x20 fp=0xc420657f88 sp=0xc420657f78 pc=0x1b00f20
runtime.main()
    /usr/local/go/src/runtime/proc.go:198 +0x212 fp=0xc420657fe0 sp=0xc420657f88 pc=0x701562
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420657fe8 sp=0xc420657fe0 pc=0x72f8e1

goroutine 20 [syscall]:
os/signal.signal_recv(0x0)
    /usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
    /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 5 [chan receive]:
github.com/cockroachdb/cockroach/pkg/util/log.flushDaemon()
    /go/src/github.com/cockroachdb/cockroach/pkg/util/log/clog.go:1131 +0xf1
created by github.com/cockroachdb/cockroach/pkg/util/log.init.0
    /go/src/github.com/cockroachdb/cockroach/pkg/util/log/clog.go:592 +0x110

goroutine 6 [chan receive]:
github.com/cockroachdb/cockroach/pkg/util/log.signalFlusher()
    /go/src/github.com/cockroachdb/cockroach/pkg/util/log/clog.go:601 +0x105
created by github.com/cockroachdb/cockroach/pkg/util/log.init.0
    /go/src/github.com/cockroachdb/cockroach/pkg/util/log/clog.go:593 +0x128

goroutine 22 [select, locked to thread]:
runtime.gopark(0x2569e48, 0x0, 0x2436d0b, 0x6, 0x18, 0x1)
    /usr/local/go/src/runtime/proc.go:291 +0x11a
runtime.selectgo(0xc420476f50, 0xc4204884e0)
    /usr/local/go/src/runtime/select.go:392 +0xe50
runtime.ensureSigM.func1()
    /usr/local/go/src/runtime/signal_unix.go:549 +0x1f4
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2361 +0x1
二進(jìn)制文件部署

部署

下載

wget -qO- https://binaries.cockroachdb.... | tar  xvz

拷貝

cp -i cockroach-v2.0.1.linux-amd64/cockroach /usr/local/bin

授權(quán)

chmod a+x /usr/local/bin/cockroach

部署

# cockroach start --insecure --host=0.0.0.0 --http-host=0.0.0.0 --http-port=8081  --port=26257

*
* WARNING: RUNNING IN INSECURE MODE!
* 
* - Your cluster is open for any client that can access localhost.
* - Any user, even root, can log in without providing a password.
* - Any user, connecting as root, can read or write any data in your cluster.
* - There is no network encryption nor authentication, and thus no confidentiality.
* 
* Check out how to secure your cluster: https://www.cockroachlabs.com/docs/v2.0/secure-a-cluster.html
*
CockroachDB node starting at 2018-04-28 08:22:34.397265926 +0000 UTC (took 0.7s)
build:               CCL v2.0.1 @ 2018/04/23 18:39:21 (go1.10)
admin:               http://0.0.0.0:8081
sql:                 postgresql://root@localhost:26257?sslmode=disable
logs:                /home/msxu/cockroach-v2.0.1.linux-amd64/cockroach-data/logs
temp dir:            /home/msxu/cockroach-v2.0.1.linux-amd64/cockroach-data/cockroach-temp258550286
external I/O path:   /home/msxu/cockroach-v2.0.1.linux-amd64/cockroach-data/extern
store[0]:            path=/home/msxu/cockroach-v2.0.1.linux-amd64/cockroach-data
status:              restarted pre-existing node
clusterID:           0fe058a5-9f6b-47c0-a061-3c043d7d7100
nodeID:              1
helm 部署

git clone https://github.com/helm/chart...

https://github.com/kubernetes...

helm install --name ckdb01 http://172.16.59.153:10806/charts/cockroachdb-1.1.0.tgz --set Image=172.16.59.153/devops/cockroach --set StorageClass=csi-lvm
NOTES:
CockroachDB can be accessed via port 26257 (or whatever you set the GrpcPort
value to) at the following DNS name from within your cluster:
ckdb02-public.default.svc.cluster.local

Because CockroachDB supports the PostgreSQL wire protocol, you can connect to
the cluster using any available PostgreSQL client.
For example, you can open up a SQL shell to the cluster by running:

    kubectl run -it --rm cockroach-client 
        --image=cockroachdb/cockroach 
        --restart=Never 
        --command -- ./cockroach sql --insecure --host ckdb02-cockroachdb-public.default

From there, you can interact with the SQL shell as you would any other SQL shell,
confident that any data you write will be safe and available even if parts of
your cluster fail.



Finally, to open up the CockroachDB admin UI, you can port-forward from your
local machine into one of the instances in the cluster:

    kubectl port-forward ckdb02-cockroachdb-0 8080
Then you can access the admin UI at http://localhost:8080/ in your web browser.

For more information on using CockroachDB, please see the project"s docs at
https://www.cockroachlabs.com/docs/
kubectl run -it --rm cockroach-client 
    --image=172.16.59.153/devops/cockroach 
    --restart=Never 
    --command -- ./cockroach sql --insecure --host ckdb02-cockroachdb-public.default

kubectl run -it --rm cockroach-client

    --image=172.16.59.153/devops/cockroach:v2.0.0 
    --restart=Never 
    --command -- ./cockroach sql --insecure --host ckdb02-cockroachdb-public.default

cockroachDB 操作

進(jìn)入

cockroach sql --insecure

顯示所有庫(kù)

show databases;

選擇庫(kù):

use 庫(kù)名;

顯示數(shù)據(jù)庫(kù)下的所有表:

show tables;

查看表基本結(jié)構(gòu)語(yǔ)句DESCRIBE

DESCRIBE 表名

SHOW CREATE TABLE 表名

實(shí)際中我一般使用DESC 表名來(lái)查看表的結(jié)構(gòu),我們可以查出各字段的字段名,數(shù)據(jù)類型,完整性約束條件。這種查詢是用表格來(lái)顯示表結(jié)構(gòu)的,所以看起來(lái)比較漂亮,但是查出來(lái)的內(nèi)容不是太多;

使用SHOW CREATE TABLE 表名來(lái)查看表的結(jié)構(gòu),除了查出上面的信息之外,還可以查出表的存儲(chǔ)引擎(ENGINE),自增的當(dāng)前值,字符編碼等信息。可以用G來(lái)結(jié)尾,使得結(jié)果容易閱讀

DELETE 語(yǔ)句用于刪除表中的行。

DELETE FROM table_name
WHERE some_column=some_value;

delete from tmptables where 1=1

lamp    請(qǐng)注意 SQL DELETE 語(yǔ)句中的 WHERE 子句!
WHERE 子句規(guī)定哪條記錄或者哪些記錄需要?jiǎng)h除。如果您省略了 WHERE 子句,所有的記錄都將被刪除!

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/28069.html

相關(guān)文章

  • cockroachDB部署使用

    容器部署 容器部署 拉取鏡像 docker pull cockroachdb/cockroach:v2.0.1 創(chuàng)建網(wǎng)絡(luò) docker network create -d bridge roachnet 查看網(wǎng)絡(luò)(不清楚為什么沒(méi)有docker0,或者docker0和eb330591e579的關(guān)系) # docker network ls NETWORK ID NAME ...

    chaosx110 評(píng)論0 收藏0
  • 【開(kāi)源訪談】黃東旭:“無(wú)人區(qū)”的探索者,TiDB 的前行之路

    摘要:日前,我司聯(lián)合創(chuàng)始人兼黃東旭接受了開(kāi)源中國(guó)的開(kāi)源訪談,公開(kāi)解讀了的探索之路及未來(lái)方向。應(yīng)用場(chǎng)景上在行業(yè)內(nèi)使用更廣泛,目前涉及互聯(lián)網(wǎng)游戲金融政府電信制造業(yè)等多個(gè)領(lǐng)域。目前也與包括騰訊云在內(nèi)的多家公有云平臺(tái)完成了整合,提供公有云數(shù)據(jù)庫(kù)服務(wù)。 日前,我司聯(lián)合創(chuàng)始人兼 CTO 黃東旭接受了開(kāi)源中國(guó)的【開(kāi)源訪談】,公開(kāi)解讀了 TiDB 的探索之路及未來(lái)方向。本文為專訪實(shí)錄~ :) 記者:王練 口...

    lixiang 評(píng)論0 收藏0
  • 如何將SQL數(shù)據(jù)映射到KV數(shù)據(jù)庫(kù)

    摘要:同時(shí),目錄層還可以將表的元數(shù)據(jù)轉(zhuǎn)換到該二進(jìn)制前綴。默認(rèn)有一個(gè)根目錄,目錄名叫,包含所有層用到的所有鍵,下層目錄叫做,用于區(qū)數(shù)據(jù)和元數(shù)據(jù)。 日常吐槽 國(guó)外文章也不是都是好文章啊,不要見(jiàn)到英文就覺(jué)得高大上了…… 前言 越來(lái)越多的關(guān)系型數(shù)據(jù)庫(kù)底層選擇基于KV構(gòu)建,例如TiDB的TiKV(RocksDB),cockroach的levelDB,MySQL的tokudb,以及被蘋果墻掉的Found...

    cuieney 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<