pgvector向量数据库搭建和使用
# 安装
# 官网
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql
# 在 postgres 用户下
# 进入数据库 postgres / postgres
sudo su - postgres
psql
# 初始化
create user biyao with password 'spider@biyao2013';
CREATE DATABASE vector_test;
GRANT ALL PRIVILEGES ON DATABASE vector_test to biyao;
# 远程连接
vim /etc/postgresql/15/main/postgresql.conf
listen_addresses = '*'
vim /etc/postgresql/15/main/pg_hba.conf
直接添加 host all all 0.0.0.0/0 trust
# 服务重启
service postgresql restart
# pgvector
git clone --branch v0.4.4 https://ghproxy.com/https://github.com/pgvector/pgvector.git
cd pgvector
# 需要先安装一下
sudo apt install postgresql-server-dev-15
sudo apt-get install gcc make
make & make install
# 教程
https://juejin.cn/post/7236541021121871928
https://hanggi.me/post/kubernetes/k8s-postgresql/
https://github.com/pgvector/pgvector
https://github.com/pgvector/pgvector#installation-notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 参考
上次更新: 2023-07-23 19:24:26