安装使用

编译

环境依赖

  • 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
  1. [global]
  2. # the name will validate join cluster by same name
  3. name = "vearch"
  4. # you data save to disk path ,If you are in a production environment, You'd better set absolute paths
  5. data = ["datas/"]
  6. # log path , If you are in a production environment, You'd better set absolute paths
  7. log = "logs/"
  8. # default log type for any model
  9. level = "debug"
  10. # master <-> ps <-> router will use this key to send or receive data
  11. signkey = "vearch"
  12. skip_auth = true
  13.  
  14. # if you are master you'd better set all config for router and ps and router and ps use default config it so cool
  15. [[masters]]
  16. # name machine name for cluster
  17. name = "m1"
  18. # ip or domain
  19. address = "127.0.0.1"
  20. # api port for http server
  21. api_port = 8817
  22. # port for etcd server
  23. etcd_port = 2378
  24. # listen_peer_urls List of comma separated URLs to listen on for peer traffic.
  25. # 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.
  26. etcd_peer_port = 2390
  27. # List of this member's client URLs to advertise to the public.
  28. # The URLs needed to be a comma-separated list.
  29. # advertise_client_urls AND listen_client_urls
  30. etcd_client_port = 2370
  31.  
  32. [router]
  33. # port for server
  34. port = 9001
  35.  
  36. [ps]
  37. # port for server
  38. rpc_port = 8081
  39. # raft config begin
  40. raft_heartbeat_port = 8898
  41. raft_replicate_port = 8899
  42. heartbeat-interval = 200 #ms
  43. raft_retain_logs = 10000
  44. raft_replica_concurrency = 1
  45. raft_snap_concurrency = 1
  • 启动
  1. ./vearch -conf conf.toml

使用示例