百分百營銷軟件官網(wǎng)seo是啥軟件
前言
最近有個物聯(lián)網(wǎng)項目,需要存儲物聯(lián)網(wǎng)終端發(fā)送過來的信息(類似log日志,但又要存儲在數(shù)據(jù)庫里,方便后期聚合統(tǒng)計),本來想寫文件的奈何客戶要求聚合統(tǒng)計,所以只能用數(shù)據(jù)庫才能達(dá)到更高的計算效率,當(dāng)然mysql對這種日志型數(shù)據(jù)庫并沒有優(yōu)勢,數(shù)據(jù)量上去后反而不利于計算,所以就研究了一下列式數(shù)據(jù)庫,看到寶塔有clickhouse就研究了一下,但是期間遇到很多坑這里把解決方案分享出來供大家參考
踩坑
1號坑 docker內(nèi)部無法訪問宿主機的clickhouse
[error] failed to initialize database, got error dial tcp 172.17.0.1:9000: connect: connection refused
- 解決方案:
1) 使用網(wǎng)卡docker0的ip地址訪問,在宿主機執(zhí)行ip add即可看到這個網(wǎng)卡
我的env配置如下
DB_CLICK_HOST=172.17.0.1
2)上面ip配置后依然無法訪問,提示connect: connection refused,這里還要修改配置文件,在端口下面添加listen_host即可:
<listen_host>0.0.0.0</listen_host>
3)上面ip配置后依然無法訪問,提示connect: connection refused,這里還要進(jìn)行寶塔>安全>系統(tǒng)防火墻端口放行(如果需要外網(wǎng)訪問clickhouse,那還需要到運營商那邊放開對應(yīng)端口,只是docker容器訪問不需要到運營商放):
2號坑 能鏈接了,但是提示密碼或者用戶不對
報錯如下:
[0m[31m[error] [0mfailed to initialize database, got error code: 516, message: default: Authentication failed: password is incorrect, or there is no user with such name.If you have installed ClickHouse and forgot password you can reset it in the configuration file.
The password for default user is typically located at /etc/clickhouse-server/users.d/default-password.xml
and deleting this file will reset the password.
See also /etc/clickhouse-server/users.xml on the server where ClickHouse is installed.
出現(xiàn)這個問題需要將密碼放到user.xml配置中去(clickhouse面板配置的密碼好像無效,這個問題我反饋給寶塔官方了看這里https://www.bt.cn/bbs/thread-139714-1-1.html)