Installation and Use

Compile

Environmental dependence

  1. CentOS, Ubuntu and Mac OS are all OK (recommend CentOS >= 7.2).

  2. go >= 1.19 required.

  3. gcc >= 5 required.(recommend gcc >= 9 if want to use scann)

  4. cmake >= 3.17 required.

  5. OpenBLAS.

  6. tbb,In CentOS it can be installed by yum. Such as: yum install tbb-devel.x86_64.

  7. RocksDB == 6.2.2 (optional). You don’t need to install it manually, the script installs it automatically. But you need to manually install the dependencies of rocksdb. Please refer to the installation method: https://github.com/facebook/rocksdb/blob/master/INSTALL.md

  8. CUDA >= 9.0, if you want GPU support.

Compile

  • Enter the GOPATH directory, cd $GOPATH/src mkdir -p github.com/vearch cd github.com/vearch

  • Download the source code: git clone https://github.com/vearch/vearch.git ($vearch denotes the absolute path of vearch code)

  • To add GPU Index support: change BUILD_WITH_GPU from “off” to “on” in $vearch/engine/CMakeLists.txt

  • To add Scann Index support: change BUILD_WITH_SCANN from “off” to “on” in $vearch/engine/CMakeLists.txt

  • Compile vearch and gamma

    1. cd build

    2. sh build.sh

    generate vearchfile compile success

Deploy

Before run vearch, you shuld set LD_LIBRARY_PATH, Ensure that system can find gamma dynamic libraries. The gamma dynamic library that has been compiled is in the $vearch/build/gamma_build folder.

Local Model:

  • generate configuration file 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. # if you are master you'd better set all config for router and ps and router and ps use default config it so cool
  14. [[masters]]
  15. # name machine name for cluster
  16. name = "m1"
  17. # ip or domain
  18. address = "127.0.0.1"
  19. # api port for http server
  20. api_port = 8817
  21. # port for etcd server
  22. etcd_port = 2378
  23. # listen_peer_urls List of comma separated URLs to listen on for peer traffic.
  24. # 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.
  25. etcd_peer_port = 2390
  26. # List of this member's client URLs to advertise to the public.
  27. # The URLs needed to be a comma-separated list.
  28. # advertise_client_urls AND listen_client_urls
  29. etcd_client_port = 2370
  30. [router]
  31. # port for server
  32. port = 9001
  33. [ps]
  34. # port for server
  35. rpc_port = 8081
  36. # raft config begin
  37. raft_heartbeat_port = 8898
  38. raft_replicate_port = 8899
  39. heartbeat-interval = 200 #ms
  40. raft_retain_logs = 10000
  41. raft_replica_concurrency = 1
  42. raft_snap_concurrency = 1
  • start
  1. ./vearch -conf conf.toml all

Cluster Model:

  • vearch has three module: ps(PartitionServer) , master, router, run ./vearch -f conf.toml ps/router/master start ps/router/master module

Now we have five machine, two master, two ps and one router

  • master

    • 192.168.1.1

    • 192.168.1.2

  • ps

    • 192.168.1.3

    • 192.168.1.4

  • router

    • 192.168.1.5
  1. [global]
  2. name = "vearch"
  3. data = ["datas/"]
  4. log = "logs/"
  5. level = "info"
  6. signkey = "vearch"
  7. skip_auth = true
  8. # if you are master, you'd better set all config for router、ps and router, ps use default config it so cool
  9. [[masters]]
  10. name = "m1"
  11. address = "192.168.1.1"
  12. api_port = 8817
  13. etcd_port = 2378
  14. etcd_peer_port = 2390
  15. etcd_client_port = 2370
  16. [[masters]]
  17. name = "m2"
  18. address = "192.168.1.2"
  19. api_port = 8817
  20. etcd_port = 2378
  21. etcd_peer_port = 2390
  22. etcd_client_port = 2370
  23. [router]
  24. port = 9001
  25. skip_auth = true
  26. [ps]
  27. rpc_port = 8081
  28. raft_heartbeat_port = 8898
  29. raft_replicate_port = 8899
  30. heartbeat-interval = 200 #ms
  31. raft_retain_logs = 10000
  32. raft_replica_concurrency = 1
  33. raft_snap_concurrency = 1
  • on 192.168.1.1 , 192.168.1.2 run master
  1. ./vearch -conf config.toml master
  • on 192.168.1.3 , 192.168.1.4 run ps
  1. ./vearch -conf config.toml ps
  • on 192.168.1.5 run router
  1. ./vearch -conf config.toml router