安装使用
编译
环境依赖
- Linux 系统(推荐CentOS 7.2以上),支持cmake、make 命令
- Go版本1.11.2以上
- Gcc版本5以上
- Faiss编译
下载源代码: git clone https://github.com/vearch/vearch.git (后续使用$vearch代表vearch目录绝对路径)
编译gamma
cd $vearch/engine/gamma/src
mkdir build && cd build
export Faiss_HOME=faiss安装路径
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$vearch/ps/engine/gammacb/lib ..
make && make install
编译vearch
cd $vearch
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$vearch/ps/engine/gammacb/lib/lib
export Faiss_HOME=faiss安装路径
go build -a —tags=vector -o vearch
生成vearch
文件表示编译成功
部署
以单机模式为例:
- 生成配置文件conf.toml
- [global]
- # the name will validate join cluster by same name
- name = "vearch"
- # you data save to disk path ,If you are in a production environment, You'd better set absolute paths
- data = ["datas/"]
- # log path , If you are in a production environment, You'd better set absolute paths
- log = "logs/"
- # default log type for any model
- level = "debug"
- # master <-> ps <-> router will use this key to send or receive data
- signkey = "vearch"
- skip_auth = true
- # if you are master you'd better set all config for router and ps and router and ps use default config it so cool
- [[masters]]
- # name machine name for cluster
- name = "m1"
- # ip or domain
- address = "127.0.0.1"
- # api port for http server
- api_port = 8817
- # port for etcd server
- etcd_port = 2378
- # listen_peer_urls List of comma separated URLs to listen on for peer traffic.
- # advertise_peer_urls List of this member's peer URLs to advertise to the rest of the cluster. The URLs needed to be a comma-separated list.
- etcd_peer_port = 2390
- # List of this member's client URLs to advertise to the public.
- # The URLs needed to be a comma-separated list.
- # advertise_client_urls AND listen_client_urls
- etcd_client_port = 2370
- [router]
- # port for server
- port = 9001
- [ps]
- # port for server
- rpc_port = 8081
- # raft config begin
- raft_heartbeat_port = 8898
- raft_replicate_port = 8899
- heartbeat-interval = 200 #ms
- raft_retain_logs = 10000
- raft_replica_concurrency = 1
- raft_snap_concurrency = 1
- 启动
- ./vearch -conf conf.toml