Nebula Graph Client API in C++
  • C++ 97.8%
  • Thrift 1%
  • CMake 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nobizx b1fa7bb16f
fix MetaClient bug (#144)
* fix MetaClient bug

* Init the value of MetaClient leader

* rename variables and replace magic numbers

* fix the bug in updateLeader function

* fix compilation errors

* ci: retrigger workflow

---------

Co-authored-by: jingchun.xia <6269380+xiajingchun@users.noreply.github.com>
2026-10-15 15:22:26 +08:00
.github fix: centos7 openssl: command not found (#156) 2026-10-15 15:07:16 +08:00
.linters/cpp Remove common clause. (#61) 2021-11-09 17:44:26 +08:00
certs Add test for CA verification. (#110) 2023-01-13 14:09:02 +08:00
cmake Fix SSL test certificates, Clang linking and session validity & Fix parallel timeout tests and CI example execution (#155) 2026-10-15 14:14:58 +08:00
examples Fix SSL test certificates, Clang linking and session validity & Fix parallel timeout tests and CI example execution (#155) 2026-10-15 14:14:58 +08:00
include fix MetaClient bug (#144) 2026-10-15 15:22:26 +08:00
package Remove common clause. (#61) 2021-11-09 17:44:26 +08:00
src fix MetaClient bug (#144) 2026-10-15 15:22:26 +08:00
third-party Fix baseurl error for third party and gcc (#146) 2026-10-14 13:31:23 +08:00
.clang-format Support duration. (#83) 2021-12-31 15:57:07 +08:00
.gitignore Add api for master (#127) 2024-01-27 20:40:49 +08:00
.licenserc.yaml Remove common clause. (#61) 2021-11-09 17:44:26 +08:00
CMakeLists.txt update storage client for plato (#68) 2021-12-06 14:43:37 +08:00
date.py Remove common clause. (#61) 2021-11-09 17:44:26 +08:00
doxygen-config Add api for master (#127) 2024-01-27 20:40:49 +08:00
exported-symbols.map Expose scan vertex. (#114) 2023-03-08 17:40:32 +08:00
gen-interface.sh Update. (#74) 2021-12-13 10:18:55 +08:00
LICENSE Remove common clause. (#61) 2021-11-09 17:44:26 +08:00
README.md add retryConnect() when using session pool (#120) 2023-08-21 14:15:51 +08:00
SECURITY.md add SECURITY.md (#139) 2024-12-16 10:26:14 +08:00

How to use cpp client lib

Option One: Get package from github

Down package

wget https://github.com/vesoft-inc/nebula-cpp/releases/download/$release-version/nebula-graph-client-$version.$system.x86_64.rpm

Install lib to local

  • Centos
bash> sudo rpm -ivh nebula-graph-client-$version.$system.x86_64.rpm
  • Ubuntu
bash> sudo dpkg -i nebula-graph-client-$version.$system.amd64.deb

Update the dynamic library cache

bash> ldconfig

Option Two: Build by source code

clone nebula src

git clone https://github.com/vesoft-inc/nebula-cpp.git

build

bash> cd nebula-cpp && mkdir build && cd build
bash> cmake ..
bash> make && sudo make install

If your g++ can't support c++11, you need to configure building by cmake like this

bash> cmake -DDISABLE_CXX11_ABI=ON ..

after finish building, cp the lib and include files to your dir

How to use in your code

  • Step 1: init arvs(a process can only call once)
  • Step 2: init connection pool, the default connections is 10, timeout is 1000 ms (a process can only call once),
  • Step 3: get a session
  • Step 4: execute your statements
  • Step 5: release session

Please refer to the sample code on detail usage.

build and run example code If your g++ version is more than 5.0

LIBRARY_PATH=${Your Installed Library Folder}:$LIBRARY_PATH g++ -std=c++11 SessionExample.cpp -I${Your Installed Include folder} -lnebula_graph_client -o session_example

If your g++ version is less than 5.0

LIBRARY_PATH=${Your Installed Library Folder}:$LIBRARY_PATH g++ -std=c++11 SessionExample.cpp -I${Your Installed Include folder} -lnebula_graph_client -o session_example -D _GLIBCXX_USE_CXX11_ABI=0

Run the example (require a available nebula graph 2.0 server in '127.0.0.1:9669')

LD_LIBRARY_PATH=${Your Installed Library Folder}:$LD_LIBRARY_PATH ./session_example

Or if you're familiar to cmake you could try build and run by cmake directly.

Note: If you install by rpm or deb package, the default install path of rpm or deb package is /usr/local/nebula, the ${Your Installed Library Folder} is /usr/local/nebula/lib or /usr/local/nebula/lib64, the ${Your Installed Include folder} is /usr/local/nebula/include