### Manually Start Studio Service Source: https://docs.nebula-graph.com.cn/3.8.0/nebula-studio/deploy-connect/st-ug-deploy Use this command to manually start the Studio service if it fails to start automatically during installation or if you need to restart it. ```bash $ bash /usr/local/nebula-graph-studio/scripts/rpm/start.sh ``` -------------------------------- ### Example: Setup and Create Full-Text Indexes Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/15.full-text-index-statements/1.search-with-text-based-index Demonstrates the steps to set up a graph space, connect to a text search service, add a listener, create tags, and then create single and multi-property full-text indexes. ```ngql //创建图空间。 nebula> CREATE SPACE IF NOT EXISTS basketballplayer (partition_num=3,replica_factor=1, vid_type=fixed_string(30)); //登录文本搜索客户端。 nebula> SIGN IN TEXT SERVICE (192.168.8.100:9200, HTTP); //检查是否成功登录。 nebula> SHOW TEXT SEARCH CLIENTS; +-----------------+-----------------+------+ | Type | Host | Port | +-----------------+-----------------+------+ | "ELASTICSEARCH" | "192.168.8.100" | 9200 | +-----------------+-----------------+------+ //切换图空间。 nebula> USE basketballplayer; //添加 listener 到 NebulaGraph 集群。 nebula> ADD LISTENER ELASTICSEARCH 192.168.8.100:9789; //检查是否成功添加 listener,当状态为 Online 时表示成功添加。 nebula> SHOW LISTENER; +--------+-----------------+------------------------+-------------+ | PartId | Type | Host | Host Status | +--------+-----------------+------------------------+-------------+ | 1 | "ELASTICSEARCH" | ""192.168.8.100":9789" | "ONLINE" | | 2 | "ELASTICSEARCH" | ""192.168.8.100":9789" | "ONLINE" | | 3 | "ELASTICSEARCH" | ""192.168.8.100":9789" | "ONLINE" | +--------+-----------------+------------------------+-------------+ //创建 Tag。 nebula> CREATE TAG IF NOT EXISTS player(name string, city string); //创建单属性全文索引。 nebula> CREATE FULLTEXT TAG INDEX fulltext_index_1 ON player(name) ANALYZER="standard"; //创建多属性全文索引。 nebula> CREATE FULLTEXT TAG INDEX fulltext_index_2 ON player(name,city) ANALYZER="standard"; //重建全文索引。 nebula> REBUILD FULLTEXT INDEX; //查看全文索引。 nebula> SHOW FULLTEXT INDEXES; +--------------------+-------------+-------------+--------------+------------+ | Name | Schema Type | Schema Name | Fields | Analyzer | +--------------------+-------------+-------------+--------------+------------+ | "fulltext_index_1" | "Tag" | "player" | "name" | "standard" | | "fulltext_index_2" | "Tag" | "player" | "name, city" | "standard" | +--------------------+-------------+-------------+--------------+------------+ ``` -------------------------------- ### Install NebulaGraph DEB Package (Example) Source: https://docs.nebula-graph.com.cn/3.8.0/2.quick-start/3.quick-start-on-premise/2.install-nebula-graph Example command to install a NebulaGraph DEB package for Ubuntu 18.04, version 3.8.0, to the default installation path. ```bash sudo dpkg -i nebula-graph-3.8.0.ubuntu1804.amd64.deb ``` -------------------------------- ### Setup and Verification for DELETE TAG Examples Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/10.tag-statements/6.delete-tag These commands set up sample tags and vertices, then fetch properties to verify the state before and after deleting tags. This is useful for testing the DELETE TAG statement. ```nGQL nebula> CREATE TAG IF NOT EXISTS test1(p1 string, p2 int); nebula> CREATE TAG IF NOT EXISTS test2(p3 string, p4 int); nebula> INSERT VERTEX test1(p1, p2),test2(p3, p4) VALUES "test":("123", 1, "456", 2); nebula> FETCH PROP ON * "test" YIELD vertex AS v; +------------------------------------------------------------+ | v | +------------------------------------------------------------+ | ("test" :test1{p1: "123", p2: 1} :test2{p3: "456", p4: 2}) | +------------------------------------------------------------+ nebula> FETCH PROP ON * "test" YIELD vertex AS v; +-----------------------------------+ | v | +-----------------------------------+ | ("test" :test2{p3: "456", p4: 2}) | +-----------------------------------+ nebula> FETCH PROP ON * "test" YIELD vertex AS v; +---+ | v | +---+ +---+ ``` -------------------------------- ### Example Output of Applied Configuration Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/3.operator-management/3.2.update-operator Shows a sample output from `helm get values`, illustrating how user-supplied values are presented. This helps in verifying specific settings like AdmissionWebhook. ```yaml USER-SUPPLIED VALUES: admissionWebhook: create: true ``` -------------------------------- ### Start Raft Listener Service Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/6.deploy-text-based-index/3.deploy-listener Execute this command in the installation directory of the listener cluster to start the listener service. Ensure the configuration file path is correct. ```bash ./bin/nebula-storaged --flagfile etc/nebula-storaged-listener.conf ``` -------------------------------- ### Install NebulaGraph CPP Source: https://docs.nebula-graph.com.cn/3.8.0/14.client/3.nebula-cpp-client Install the compiled NebulaGraph C++ client to the system using sudo make install. ```bash $ sudo make install ``` -------------------------------- ### Create Example Namespace Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/2.get-started/2.1.install-operator An example of creating a specific namespace, 'nebula-operator-system', for the NebulaGraph Operator. ```bash kubectl create namespace nebula-operator-system ``` -------------------------------- ### Install NebulaGraph Python from Source Source: https://docs.nebula-graph.com.cn/3.8.0/14.client/5.nebula-python-client Install the NebulaGraph Python client after cloning the source code by running pip install in the repository directory. ```bash pip install . ``` -------------------------------- ### Extract Example Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/4.install-nebula-graph-from-tar Example of extracting the NebulaGraph 3.8.0 tar.gz file for CentOS to the /home/joe/nebula/install directory. ```bash tar -xvzf nebula-graph-3.8.0.el7.x86_64.tar.gz -C /home/joe/nebula/install ``` -------------------------------- ### Example: Inspecting a Core Dump with GDB Source: https://docs.nebula-graph.com.cn/3.8.0/20.appendix/0.FAQ This example demonstrates the output of 'file' and 'gdb bt' commands when inspecting a NebulaGraph core dump. ```bash $ file core.1316027 core.1316027: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from '/home/workspace/fork/nebula-debug/bin/nebula-metad --flagfile /home/k', real uid: 1008, effective uid: 1008, real gid: 1008, effective gid: 1008, execfn: '/home/workspace/fork/nebula-debug/bin/nebula-metad', platform: 'x86_64' $ gdb /home/workspace/fork/nebula-debug/bin/nebula-metad core.1316027 $(gdb) bt #0 0x00007f9de58fecf5 in __memcpy_ssse3_back () from /lib64/libc.so.6 #1 0x0000000000eb2299 in void std::__cxx11::basic_string, std::allocator >::_M_construct(char*, char*, std::forward_iterator_tag) () #2 0x0000000000ef71a7 in nebula::meta::cpp2::QueryDesc::QueryDesc(nebula::meta::cpp2::QueryDesc const&) () ... ``` -------------------------------- ### Nebula Graph SAMPLE Clause Example 2 Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/8.clauses-and-options/sample Illustrates sampling 2 edges at each step for a 1-to-3 step traversal. This example shows how multiple results can be returned for the same starting node if sampling selects different paths. ```nGQL nebula> GO 1 TO 3 STEPS FROM "player100" \ OVER * \ YIELD properties($$).name AS NAME, properties($$).age AS Age \ SAMPLE [2,2,2]; ``` -------------------------------- ### Example Connection to NebulaGraph Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/2.get-started/2.4.connect-to-cluster An example demonstrating how to connect to NebulaGraph using `kubectl run` with specific node IP, port, username, and password. ```bash kubectl run -ti --image vesoft/nebula-console:v3.8.0 --restart=Never -- nebula-console -addr 192.168.8.24 -port 32236 -u root -p vesoft If you don't see a command prompt, try pressing enter. (root@nebula) [(none)]> ``` -------------------------------- ### Install Studio via RPM Source: https://docs.nebula-graph.com.cn/3.8.0/nebula-studio/deploy-connect/st-ug-deploy Use this command to install the Studio RPM package. The default installation path is /usr/local/nebula-graph-studio. ```bash $ sudo rpm -i nebula-graph-studio-3.10.0.x86_64.rpm ``` -------------------------------- ### Install AutoFDO Tool Source: https://docs.nebula-graph.com.cn/3.8.0/8.service-tuning/enable_autofdo_for_nebulagraph Installs the AutoFDO tool using apt-get. Alternatively, you can compile it from source. ```bash sudo apt-get update sudo apt-get install -y autofdo ``` -------------------------------- ### Run Importer with Docker (Example) Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/use-importer An example of running the NebulaGraph Importer with Docker, specifying version and mounting configuration and data files. ```bash docker pull vesoft/nebula-importer:v4 docker run --rm -ti \ --network=host \ -v /home/user/config.yaml:/home/user/config.yaml \ -v /home/user/data:/home/user/data \ vesoft/nebula-importer:v4 \ --config /home/user/config.yaml ``` -------------------------------- ### Install logrotate on Debian/Ubuntu Source: https://docs.nebula-graph.com.cn/3.8.0/5.configurations-and-logs/2.log-management/logs Install the logrotate utility on Debian or Ubuntu systems using apt-get. ```bash sudo apt-get install logrotate ``` -------------------------------- ### Example Spark Submit Command Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/use-exchange/ex-ug-import-from-pulsar An example of how to execute the spark-submit command with specific JAR and configuration file paths. ```bash ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange_spark_2.4-3.8.0.jar -c /root/nebula-exchange/nebula-exchange/target/classes/pulsar_application.conf ``` -------------------------------- ### Install NebulaGraph Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code Install the compiled NebulaGraph binaries and related files using 'make install'. This command typically requires superuser privileges. ```bash $ sudo make install ``` -------------------------------- ### Nebula Graph SAMPLE Clause Example 1 Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/8.clauses-and-options/sample Demonstrates sampling 1 edge at step 1, 2 edges at step 2, and 3 edges at step 3 during a 3-step traversal from a starting node. Results include properties like name and age. ```nGQL nebula> GO 3 STEPS FROM "player100" \ OVER * \ YIELD properties($$).name AS NAME, properties($$).age AS Age \ SAMPLE [1,2,3]; ``` -------------------------------- ### Start All NebulaGraph Services Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/manage-service Execute this command to start all NebulaGraph services (metad, graphd, and storaged). Ensure you have the necessary permissions. ```bash sudo /usr/local/nebula/scripts/nebula.service start all [INFO] Starting nebula-metad... [INFO] Done [INFO] Starting nebula-graphd... [INFO] Done [INFO] Starting nebula-storaged... [INFO] Done ``` -------------------------------- ### Example Download SST Files Command Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/use-exchange/ex-ug-import-from-sst An example of the SUBMIT JOB DOWNLOAD command, specifying the HDFS path for SST files. ```nebula nebula> SUBMIT JOB DOWNLOAD HDFS "hdfs://*.*.*.*:9000/sst"; ``` -------------------------------- ### Example Spark Submit Command for Nebula-Exchange Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/use-exchange/ex-ug-import-from-parquet A concrete example of the spark-submit command for Nebula-Exchange, including the JAR path and configuration file path. ```bash ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange_spark_2.4-3.8.0.jar -c /root/nebula-exchange/nebula-exchange/target/classes/parquet_application.conf ``` -------------------------------- ### Example Uninstall NebulaGraph (RPM) Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/4.uninstall-nebula-graph An example of how to uninstall a specific NebulaGraph RPM package. ```shell sudo rpm -e nebula-graph-3.8.0-1.x86_64 ``` -------------------------------- ### Example Uninstall NebulaGraph (DEB) Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/4.uninstall-nebula-graph An example of how to uninstall the NebulaGraph DEB package. ```shell sudo dpkg -r nebula-graph ``` -------------------------------- ### Example NebulaGraph Exchange Import Command Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/use-exchange/ex-ug-import-from-orc An example of the spark-submit command for importing data, showing specific paths for the JAR file and the configuration file. ```bash ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange_spark_2.4-3.8.0.jar -c /root/nebula-exchange/nebula-exchange/target/classes/orc_application.conf ``` -------------------------------- ### Start All NebulaGraph Dashboard Services Source: https://docs.nebula-graph.com.cn/3.8.0/nebula-dashboard/2.deploy-dashboard This command starts all NebulaGraph Dashboard services. Ensure you are in the extracted `nebula-dashboard` directory. ```bash ./dashboard.service start all ``` -------------------------------- ### Install Third-Party Dependencies Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code Navigate to the third-party directory and execute the installation script for NebulaGraph's dependencies. ```bash $ cd nebula/third-party $ ./install-third-party.sh ``` -------------------------------- ### Example Output of SHOW SNAPSHOTS Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/7.general-query-statements/6.show/11.show-snapshots This is an example of the output returned by the SHOW SNAPSHOTS statement, showing snapshot names, their status, and the hosts they are associated with. ```text +--------------------------------+---------+-----------------------------------------------------+ | Name | Status | Hosts | +--------------------------------+---------+-----------------------------------------------------+ | "SNAPSHOT_2020_12_16_11_13_55" | "VALID" | "storaged0:9779, storaged1:9779, storaged2:9779" | | "SNAPSHOT_2020_12_16_11_14_10" | "VALID" | "storaged0:9779, storaged1:9779, storaged2:9779" | +--------------------------------+---------+-----------------------------------------------------+ ``` -------------------------------- ### View Example NebulaGraph Cluster Labels Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/3.operator-management/3.5.cluster-scope-config Example of viewing labels for the 'nebula' cluster in the 'nebulaspace' namespace. ```bash kubectl get nc nebula -n nebulaspace --show-labels ``` -------------------------------- ### View All Configuration Options for a Service Source: https://docs.nebula-graph.com.cn/3.8.0/5.configurations-and-logs/1.configurations/1.configurations Use the --help flag with the service's binary to list all available configuration options and their descriptions. This is useful for understanding what can be configured. ```bash --help ``` ```bash # Get help information for Meta configuration items $ /usr/local/nebula/bin/nebula-metad --help # Get help information for Graph configuration items $ /usr/local/nebula/bin/nebula-graphd --help # Get help information for Storage configuration items $ /usr/local/nebula/bin/nebula-storaged --help ``` -------------------------------- ### Set Example Label for NebulaGraph Cluster Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/3.operator-management/3.5.cluster-scope-config Example of setting the 'env=test' label for a NebulaGraph cluster named 'nebula' in the 'nebulaspace' namespace. ```bash kubectl label nc nebula -n nebulaspace env=test ``` -------------------------------- ### Generate Example Configuration Template Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/parameter-reference/ex-ug-parameter Use this command to generate an example configuration file for a specified data source type. Replace placeholders with your actual JAR package, source type, and desired save path. ```bash java -cp com.vesoft.exchange.common.GenerateConfigTemplate -s -p ``` ```bash java -cp nebula-exchange_spark_2.4-3.0-SNAPSHOT.jar com.vesoft.exchange.common.GenerateConfigTemplate -s csv -p /home/nebula/csv_application.conf ``` -------------------------------- ### Get Start Node of a Path using startNode() Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/6.functions-and-expressions/4.schema The startNode() function retrieves the starting vertex information from a path, including its ID, tag, properties, and values. ```ngql MATCH p = (a :player {name : "Tim Duncan"})-[r:serve]-(t) RETURN startNode(p); ``` -------------------------------- ### openCypher SKIP Example: Players after Offset Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/8.clauses-and-options/limit This example demonstrates using SKIP to return players' names and ages, starting after the first one, ordered by age in descending order. ```nGQL nebula> MATCH (v:player{name:"Tim Duncan"}) --> (v2) RETURN v2.player.name AS Name, v2.player.age AS Age ORDER BY Age DESC SKIP 1; ``` -------------------------------- ### Local Full Backup Example Source: https://docs.nebula-graph.com.cn/3.8.0/backup-and-restore/nebula-br/3.br-backup-data Example of performing a full backup and saving it to a local directory. If multiple meta services exist, manually copy the leader meta's backup directory to follower meta directories. ```bash ./br backup full --meta "192.168.8.129:9559" --storage "local:///home/nebula/backup/" ``` -------------------------------- ### Install NebulaGraph Operator with Specific Version Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/2.get-started/2.1.install-operator An example command to install version 1.8.0 of the NebulaGraph Operator. If --version is omitted, the latest chart version is used by default. ```bash helm install nebula-operator nebula-operator/nebula-operator --namespace=nebula-operator-system --version=1.8.0 ``` -------------------------------- ### openCypher SKIP and LIMIT Example Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/8.clauses-and-options/limit This example combines SKIP and LIMIT to return a specific number of rows starting from a defined offset, retrieving one player after skipping one, ordered by age descending. ```nGQL nebula> MATCH (v:player{name:"Tim Duncan"}) --> (v2) RETURN v2.player.name AS Name, v2.player.age AS Age ORDER BY Age DESC SKIP 1 LIMIT 1; ``` -------------------------------- ### Enable NebulaGraph Services for Auto-start Source: https://docs.nebula-graph.com.cn/3.8.0/20.appendix/0.FAQ Use 'systemctl enable' to configure NebulaGraph services (metad, graphd, storaged) to start automatically on boot. ```bash [root]# systemctl enable nebula-metad.service Created symlink from /etc/systemd/system/multi-user.target.wants/nebula-metad.service to /usr/lib/systemd/system/nebula-metad.service. [root]# systemctl enable nebula-graphd.service Created symlink from /etc/systemd/system/multi-user.target.wants/nebula-graphd.service to /usr/lib/systemd/system/nebula-graphd.service. [root]# systemctl enable nebula-storaged.service Created symlink from /etc/systemd/system/multi-user.target.wants/nebula-storaged.service to /usr/lib/systemd/system/nebula-storaged.service. ``` -------------------------------- ### Native nGQL LIMIT Example: Offset and Rows Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/8.clauses-and-options/limit This example shows how to use LIMIT with an offset to retrieve 3 rows starting from the second row after ordering the results by Age and Friend in native nGQL. ```nGQL nebula> GO FROM "player100" OVER follow REVERSELY YIELD properties($$).name AS Friend, properties($$).age AS Age | ORDER BY $-.Age, $-.Friend | LIMIT 1, 3; ``` -------------------------------- ### Extract Subgraph with GET SUBGRAPH Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/7.general-query-statements/1.general-query-statements-overview Use GET SUBGRAPH to extract a portion of the graph based on specified criteria, such as a number of steps from a starting vertex. The YIELD clause returns the vertices and edges within the extracted subgraph. ```nGQL GET SUBGRAPH 5 STEPS FROM "player101" YIELD VERTICES AS nodes, EDGES AS relationships; ``` -------------------------------- ### Start NebulaGraph Services with Docker Compose Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/3.deploy-nebula-graph-with-docker-compose Use Docker Compose to start the NebulaGraph services in detached mode. This command initiates all necessary containers for a functional NebulaGraph cluster. Ensure Docker and Docker Compose are installed and running. ```bash [nebula-docker-compose]$ docker-compose up -d ``` -------------------------------- ### Compile C++ Application with NebulaGraph Client (Example Paths) Source: https://docs.nebula-graph.com.cn/3.8.0/14.client/3.nebula-cpp-client Example compilation command for a C++ application using the NebulaGraph client with default library and include paths. ```bash $ LIBRARY_PATH=/usr/local/nebula/lib64:$LIBRARY_PATH g++ -std=c++11 SessionExample.cpp -I/usr/local/nebula/include -lnebula_graph_client -o session_example ``` -------------------------------- ### GET SUBGRAPH Statement Syntax Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/7.general-query-statements/7.get-subgraph This is the general syntax for the GET SUBGRAPH statement. Use WITH PROP to display properties, specify step_count for traversal depth, vid for starting points, edge_type with direction, WHERE for filtering, and YIELD for output definition. ```ngql GET SUBGRAPH [WITH PROP] [ {STEP|STEPS}] FROM {, ...} [{IN | OUT | BOTH} , ...] [WHERE [AND ...]] YIELD [VERTICES AS ] [, EDGES AS ]; ``` -------------------------------- ### Lookup with Full-Text Index (Prefix) Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/15.full-text-index-statements/1.search-with-text-based-index Use ES_QUERY to search for vertices with a full-text index. This example searches for players whose names start with 'Da'. ```ngql LOOKUP ON player WHERE ES_QUERY(fulltext_index_1,"Da*") YIELD properties(vertex); ``` -------------------------------- ### Start NebulaGraph Lite from Command Line Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/8.deploy-nebula-graph-with-lite Starts NebulaGraph Lite from the command line. This command deploys a single-node NebulaGraph service and imports test data. ```bash nebulagraph start ``` -------------------------------- ### Get Subgraph Information Source: https://docs.nebula-graph.com.cn/3.8.0/2.quick-start/6.cheatsheet-for-ngql-command Retrieves information about vertices and edges within a specified number of steps from a starting point. Use this to explore connected data. ```nGQL GET SUBGRAPH 1 STEPS FROM "player100" YIELD VERTICES AS nodes, EDGES AS relationships ``` -------------------------------- ### S3-Compatible Object Storage Backup Example Source: https://docs.nebula-graph.com.cn/3.8.0/backup-and-restore/nebula-br/3.br-backup-data Example of performing a full backup and saving it to an S3-compatible object storage service. Ensure all S3 parameters are correctly configured. ```bash ./br backup full --meta "192.168.8.129:9559" --s3.endpoint "http://192.168.8.129:9000" --storage="s3://br-test/backup/" --s3.access_key=minioadmin --s3.secret_key=minioadmin --s3.region=default ``` -------------------------------- ### GO Statement: Find Connected Players Source: https://docs.nebula-graph.com.cn/3.8.0/2.quick-start/3.quick-start-on-premise/4.nebula-graph-crud Example of using the GO statement to find players directly connected via the 'follow' edge from a starting player. ```nGQL nebula> GO FROM "player101" OVER follow YIELD id($$); ``` -------------------------------- ### Locate Snapshot Checkpoints Source: https://docs.nebula-graph.com.cn/3.8.0/backup-and-restore/3.manage-snapshot After creating a snapshot, checkpoints are stored in the 'checkpoints' directory within the Meta and Storage service installation paths. This example shows how to list the contents of these directories. ```bash $ ls /usr/local/nebula/data/meta/nebula/0/checkpoints/ SNAPSHOT_2021_03_09_09_10_52 $ ls /usr/local/nebula/data/storage/nebula/3/checkpoints/ SNAPSHOT_2021_03_09_09_10_52 $ ls /usr/local/nebula/data/storage/nebula/4/checkpoints/ SNAPSHOT_2021_03_09_09_10_52 ``` -------------------------------- ### Run Importer with Binary Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/use-importer Execute the Importer using a downloaded binary file and a YAML configuration file. ```bash ./ --config ``` -------------------------------- ### Get Source Vertex ID of an Edge using src() Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/6.functions-and-expressions/4.schema The src() function returns the ID of the starting vertex of an edge. The return type matches the vertex ID's type. ```ngql MATCH ()-[e]->(v:player{name:"Tim Duncan"}) RETURN src(e); ``` -------------------------------- ### CASE Expression Example (General Form - String) Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/6.functions-and-expressions/5.conditional-expressions Illustrates the general form of the CASE expression to categorize players by checking if their name starts with a specific letter. This form is flexible for complex conditions. ```nGQL nebula> MATCH (v:player) WHERE v.player.age > 30 RETURN v.player.name AS Name, CASE WHEN v.player.name STARTS WITH "T" THEN "Yes" ELSE "No" END AS Starts_with_T; +---------------------+---------------+ | Name | Starts_with_T | +---------------------+---------------+ | "Tim Duncan" | "Yes" | | "LaMarcus Aldridge" | "No" | | "Tony Parker" | "Yes" | +---------------------+---------------+ ``` -------------------------------- ### Example NebulaExchange Import Command Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/use-exchange/ex-ug-import-from-hbase An example of the spark-submit command with specific paths for the NebulaExchange JAR and HBase configuration file. This demonstrates how to replace placeholders with actual file locations. ```bash ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange_spark_2.4-3.8.0.jar -c /root/nebula-exchange/nebula-exchange/target/classes/hbase_application.conf ``` -------------------------------- ### Show Spaces Example Source: https://docs.nebula-graph.com.cn/3.8.0/20.appendix/0.FAQ Example of the `SHOW SPACES` command output, illustrating the 'time spent' metric. The first number is database execution time, and the second is client-side time. ```nGQL nebula> SHOW SPACES; +--------------------+ | Name | +--------------------+ | "basketballplayer" | +--------------------+ Got 1 rows (time spent 1235/1934 us) ``` -------------------------------- ### Querying Subgraph with GET SUBGRAPH Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/7.general-query-statements/7.get-subgraph This example demonstrates querying a subgraph with a specified hop count and edge type. The query might return results with fewer hops than specified if no further connections are found. ```ngql # 查询从点 player101 开始、0~100 跳、follow 类型的出边的子图。 nebula> GET SUBGRAPH 100 STEPS FROM "player101" OUT follow YIELD VERTICES AS nodes, EDGES AS relationships; +----------------------------------------------------+ | nodes | +----------------------------------------------------+ | [("player101" :player{})] | | [("player100" :player{}), ("player102" :player{})] | +----------------------------------------------------+ +--------------------------------------------------------------------------------------+ | relationships | +--------------------------------------------------------------------------------------+ | [[:follow "player101"->"player100" @0 {}], [:follow "player101"->"player102" @0 {}]] | | [[:follow "player102"->"player100" @0 {}]] | +--------------------------------------------------------------------------------------+ ``` -------------------------------- ### Filter nodes by name using regular expression Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/5.operators/7.string This example shows how to filter nodes of type 'player' where the 'player.name' property matches a regular expression. It returns the names of players whose names start with 'Tony'. ```nGQL MATCH (v:player) WHERE v.player.name =~ 'Tony.*' RETURN v.player.name; ``` -------------------------------- ### Run Nebula Exchange to Import Data from Neo4j Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/use-exchange/ex-ug-import-from-neo4j Execute this command to start the data import process from Neo4j to NebulaGraph. Ensure you have the correct paths for the Spark installation, Nebula Exchange JAR, and the Neo4j application configuration file. ```bash ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange -c ``` ```bash ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange_spark_2.4-3.8.0.jar -c /root/nebula-exchange/nebula-exchange/target/classes/neo4j_application.conf ``` -------------------------------- ### Adjust Process Resource Limits with prlimit Source: https://docs.nebula-graph.com.cn/3.8.0/5.configurations-and-logs/1.configurations/6.kernel-config Use the prlimit command to get or set resource limits for a process. This example adjusts the maximum number of open files for the current process. Requires Red Hat 7u or later. ```bash prlimit --nofile=140000 --pid=$$ ``` -------------------------------- ### Get Vertex Properties with properties() Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/6.functions-and-expressions/4.schema Returns all properties of a vertex as a map. Can be used with `LOOKUP` or `GO` statements. For `GO` statements, `$^` and `$$` can be used to refer to the start and end vertices respectively. Avoid using `properties().` for performance reasons. ```nGQL nebula> LOOKUP ON player WHERE player.age > 45 \ YIELD properties(vertex); +------------------------------------+ | properties(VERTEX) | +------------------------------------+ | {age: 47, name: "Shaquille O'Neal"} | | {age: 46, name: "Grant Hill"} | +------------------------------------+ ``` -------------------------------- ### Install NebulaGraph Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/7.compile-using-docker Install the compiled NebulaGraph executables and libraries to the specified installation directory within the container. ```bash make install ``` -------------------------------- ### Create and Drop Tag Example Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/10.tag-statements/2.drop-tag Demonstrates creating a tag and then dropping it. Ensure the tag has no associated indexes before dropping. ```nebula nebula> CREATE TAG IF NOT EXISTS test(p1 string, p2 int); nebula> DROP TAG test; ``` -------------------------------- ### Start Meta Service Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-comm Start all Meta services. This process involves leader election and takes a few seconds. Verify the Meta service is running by connecting to a Graph service and checking the Meta node status. ```bash /scripts/nebula-metad.service start ``` -------------------------------- ### Install NebulaGraph Lite Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/8.deploy-nebula-graph-with-lite Install NebulaGraph Lite using pip3. This command installs the necessary Python package for NebulaGraph Lite. ```bash pip3 install nebulagraph-lite ``` -------------------------------- ### Create Build Directory Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/7.compile-using-docker Create a build directory and navigate into it to prepare for the CMake configuration. ```bash mkdir build && cd build ``` -------------------------------- ### Example Service Ports Output Source: https://docs.nebula-graph.com.cn/3.8.0/k8s-operator/4.cluster-administration/4.2.configuration Sample output showing updated ports for NebulaGraph services after configuration changes. ```text NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nebula-graphd-headless ClusterIP None 3669/TCP,8080/TCP 10m nebula-graphd-svc ClusterIP 10.102.13.115 3669/TCP,8080/TCP 10m nebula-metad-headless ClusterIP None 9559/TCP,8081/TCP 11m nebula-storaged-headless ClusterIP None 9779/TCP,8082/TCP,9778/TCP 11m ``` -------------------------------- ### Install Studio using DEB Package Source: https://docs.nebula-graph.com.cn/3.8.0/nebula-studio/deploy-connect/st-ug-deploy Installs the NebulaGraph Studio DEB package. Ensure you have the correct package name for the version you are installing. ```bash sudo dpkg -i nebula-graph-studio-3.10.0.x86_64.deb ``` -------------------------------- ### Example Output of SHOW SPACES Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/7.general-query-statements/6.show/12.show-spaces This example demonstrates the typical output format when executing the SHOW SPACES statement, listing the names of available graph spaces. ```text +---------------------+ | Name | +---------------------+ | "docs" | | "basketballplayer" | +---------------------+ ``` -------------------------------- ### Compile BR from Source Source: https://docs.nebula-graph.com.cn/3.8.0/backup-and-restore/nebula-br/2.compile-br Compile the NebulaGraph BR tool using make. ```bash make ``` -------------------------------- ### Install NebulaGraph DEB Package Source: https://docs.nebula-graph.com.cn/3.8.0/2.quick-start/3.quick-start-on-premise/2.install-nebula-graph Install a downloaded NebulaGraph DEB package. Custom installation paths are not supported; the default path is /usr/local/nebula/. ```bash sudo dpkg -i ``` -------------------------------- ### Submit Spark Job with YARN and Configuration Source: https://docs.nebula-graph.com.cn/3.8.0/import-export/nebula-exchange/parameter-reference/ex-ug-para-import-command This example demonstrates submitting a Spark job using YARN mode, including necessary configurations for classpaths and specifying the application configuration file. ```bash $SPARK_HOME/bin/spark-submit --master yarn \ --class com.vesoft.nebula.exchange.Exchange \ --files application.conf \ --conf spark.driver.extraClassPath=./ \ --conf spark.executor.extraClassPath=./ \ nebula-exchange-3.8.0.jar \ -c application.conf ``` -------------------------------- ### Install perf for NebulaGraph Source: https://docs.nebula-graph.com.cn/3.8.0/8.service-tuning/enable_autofdo_for_nebulagraph Installs the necessary `perf` tools for performance profiling on Debian-based systems. Ensure your kernel version matches the installed `linux-tools`. ```bash sudo apt-get update sudo apt-get install -y linux-tools-common \ linux-tools-generic \ linux-tools-`uname -r` ``` -------------------------------- ### Show All Partitions Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/7.general-query-statements/6.show/9.show-parts Use SHOW PARTS without any arguments to display information for all partitions in the current graph space. This is useful for monitoring the status of all partitions. ```ngql SHOW PARTS; ``` -------------------------------- ### Filter Player Names Starting With 'T' Source: https://docs.nebula-graph.com.cn/3.8.0/3.ngql-guide/8.clauses-and-options/where Use STARTS WITH to match strings from the beginning. This query finds players whose names start with an uppercase 'T'. ```ngql MATCH (v:player) WHERE v.player.name STARTS WITH "T" RETURN v.player.name, v.player.age; ``` -------------------------------- ### Start NebulaGraph Cluster Services Source: https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/deploy-nebula-graph-cluster Start NebulaGraph cluster services (metad, graphd, storaged) using the provided script. Use 'all' to start all services. ```bash sudo /usr/local/nebula/scripts/nebula.service start ```