0%

使用algolia来实现文章搜索
遇到的坑:

  1. 样式错乱
    这个是本地缓存问题,清掉缓存就好了

  2. 搜索结果跳转地址不对
    因为我之前配的url是hexo.xiaohuasheng.cc,结果同步到algolia后搜索,都跳到hexo.xiaohuasheng.cc了,修改了url配置也不行,一直在hexo的目录里找,以为是哪里没改全,原来是url配置已经同步到algolia了,需要修改后再同步一次

    1
    2
    3
    hexo clean
    hexo g
    hexo algolia
  3. 新文章也要同步到搜索平台才能搜到
    所以新建后要执行hexo algolia

参考:https://blog.csdn.net/qq_45173404/article/details/122861321

查kafka数据

1
2
3
4
cd /opt/Cellar/kafka/3.4.0
./bin/kafka-topics --list --bootstrap-server localhost:9092
p4015_003
bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic p4015_003 --from-beginning

1
git pull origin master 显示 timeout

但网页可以访问github.com

1
2
3
4
5
ssh -vvv git@github.com

debug1: Connecting to github.com port 22.
ssh: connect to host github.com port 22: Operation timed out

1
telnet github.com 22 连不上
1
2
3
4
➜  bang-api git:(master) telnet github.com 443
Trying 198.18.0.118...
Connected to github.com.
Escape character is '^]'.

使用的IP不是一个公网IP,同事是可以的,从同事哪里要了一个正确的IP,修改hosts

1
2
3
sudo vi /etc/hosts

20.205.243.166 github.com

然后就可以了

还以为是ubuntu系统出什么问题了
无意中看到/etc/hosts,里面写了github的

1
20.205.243.166 github.com

原来在windows下使用switchhosts也会改变ubuntu的hosts
本来想删掉刷新DNS缓存的,但没找到方法,目前是找了一个可用的IP,在switchhosts里加上了新的记录,可以了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
➜  bang-api git:(p1w37) git cherry-pick 3e785fc8c072e46660c2194a6c5006e93309f08f
Auto-merging app/services/batch/copy_project.go
[p1w37 957e05d996] fix #328031 并发复制项目uuid重复的问题
Date: Mon Aug 22 15:49:05 2022 +0800
1 file changed, 4 insertions(+), 1 deletion(-)
➜ bang-api git:(p1w37) git checkout hotfix_320269
Switched to branch 'hotfix_320269'
Your branch is up to date with 'origin/hotfix_320269'.
➜ bang-api git:(hotfix_320269) git log
➜ bang-api git:(hotfix_320269) git checkout p1w37
Switched to branch 'p1w37'
Your branch is ahead of 'origin/p1w37' by 1 commit.
(use "git push" to publish your local commits)
➜ bang-api git:(p1w37) git cherry-pick -n -e cce2d9d6579a734a7f644ea811c1636a9d03a199..0c2a52efdc4bc2ca8f0c051208e68831388e197e

1
2
3
4
5
6
7
8
9
10
11
12
13
14
➜  P1038 git:(master) go mod tidy                                                                    
go: github.com/xhs/canal@v0.0.0-20220414041559-999a49d06083: reading https://goproxy.cn/github.com/xhs/canal/@v/v0.0.0-20220414041559-999a49d06083.mod: 404 Not Found
server response:
not found: github.com/xhs/canal@v0.0.0-20220414041559-999a49d06083: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/58038aa5791c26db501ba0c05ac1e67495df9d5cb445d748f40ccd12746af405: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
go: downloading github.com/xhs/canal v0.0.0-20220414041559-999a49d06083
go: github.com/xhs/canal@v0.0.0-20220414041559-999a49d06083: reading https://goproxy.cn/github.com/xhs/canal/@v/v0.0.0-20220414041559-999a49d06083.mod: 404 Not Found
server response:
not found: github.com/xhs/canal@v0.0.0-20220414041559-999a49d06083: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/58038aa5791c26db501ba0c05ac1e67495df9d5cb445d748f40ccd12746af405: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

访问的地址感觉不对,带着代理的地址

1
https://goproxy.cn/github.com/xhs/canal/@v/v0.0.0-20220414041559-999a49d06083.mod

去掉了依然访问不到
修改 go 环境变量,把代理去掉
go env -w GOPROXY=""
问题解决

mb4是指most byte 4,即用4个字节来存字符
utf8在MySQL的实现里是用3个字节,无法支持emoji字符
参考
https://www.jianshu.com/p/2b8629af8000?u_atoken=edb621fc-3ed8-4abd-ad79-83120b8274f3&u_asession=01imGGZau59hUSA0lzJEfQGqUMfYLIHz0KsTbBTrFDVl0zDlhCSl0_GGrcqHADYKDkX0KNBwm7Lovlpxjd_P_q4JsKWYrT3W_NKPr8w6oU7K--ZZ5hTiDSZi2tREAmAWXlyuYfe7vWV-zsHJifFo5DumBkFo3NEHBv0PZUm6pbxQU&u_asig=058un4ynxXv3LVdcU4rcDeWLjjymFr2iVA3r4usPGEL2q1zg6_AaOC5kGurmR1VLUp5jMCoTeR2-93EFJtTFiYUf4wL9lwYbUZFoLO7eJ2A0RoAEyfnUh57misSICd6yqtxl9tSUnXLsI2NKVKGUFTfoDM42Tcgs8fGclWLop1Aw79JS7q8ZD7Xtz2Ly-b0kmuyAKRFSVJkkdwVUnyHAIJzfhu2lmqe57tmDa0VKuaDrDCfz6P6mNqjVXschHU8u5pfqft3yiexPr1Pj5ASov3mu3h9VXwMyh6PgyDIVSG1W_7Z-QUHDbMSTmHz3apT0KvSbYsM8OpgUlCxiCwc8zrjusj9HUqniv2DJuZJhi8CttOrXF14p9fXI8ocDy-BddWmWspDxyAEEo4kbsryBKb9Q&u_aref=7NVuBAugN7f7QVDLT9QF500sVQM%3D