58 The practice of one-click deployment operation and maintenance architecture in the same city - cluster collocation management platform multi-scenario cost reduction and efficiency increase

> > > Graph Computing Business Background Introduction

 

Why did we choose NebulaGraph?

In each business line of the company, many departments have graph exploration scenarios such as relationship analysis. With the development of business, there are more and more related needs. A large number of requirements are implemented using a multimodal database, and the development cost and management cost are relatively high.

With the development of graph databases, related system applications are becoming more and more mature, so the introduction of professional graph databases to meet the needs of this part of the business is also on the agenda. The next issue to consider is the selection of the graph database.

First of all, NebulaGraph has a large number of application cases of major Internet companies, which effectively verifies the fact that NebulaGraph can deal with graph exploration scenarios with massive data. In addition, NebulaGraph is currently ranked 14th in the field of graph databases in DB-Engines, and the growth momentum is strong. Some of the top-ranked graph databases are not open source or stand-alone open source, and the scenarios are limited.

 

How does NebulaGraph perform in the actual test?

In terms of import performance, the import efficiency of NebulaGraph is slightly slower than that of neo4j when the amount of data is small, but the import of NebulaGraph is significantly better than the other two graph databases when the amount of data is large. In the 3rd degree query scenario, the efficiency of NebulaGraph is significantly higher than that of neo4j, and it also has certain advantages compared with HugeGraph.

 

What are the applicable scenarios

The company has a variety of online businesses with high engineering complexity and architectural complexity. Each business department needs a dedicated graph database to process and explore entity-relationship data.

Monitor the running time of task dependencies through the graph database, obtain delayed tasks in time, process the blood relationship of tasks on the sales incentive platform, analyze the class/method-level calling relationship within the application, analyze business risk data, and record corporate executives, legal persons, and shareholders. relationship, which is used in scenarios such as signing business.

 

Resource application and cluster management

For better management and maintenance, the graph database is centrally operated and managed in the operation and maintenance department. Users can submit an application on the work order platform as needed. The work order fills in the detailed resource demand data and performance demand indicators, and the operation and maintenance students uniformly review and deliver cluster resources.

The company's current server environment is a self-built computer room, using high-profile physical machines, and single-machine multi-instance mixed database services. In order to achieve large-scale management and maintenance, instance standards and rules need to be formulated in advance.

 

cluster size

Thanks to NebulaGraph's good graph computing capabilities, we have delivered nearly 20 clusters, and business departments are continuing to apply for related cluster service resources.

 

> > > NebulaGraph Specification and Architecture Design

Due to the large number of business requirements that need to be met, there will be a large number of clusters to be delivered and maintained in the future. In order to efficiently manage and operate a large-scale cluster, it is necessary to plan and formulate specifications in advance.

 

version specification

The current version is 2.0.1

 

path specification

1) The program path is /opt/soft/nebula201. There are bin, scripts, share, etc. under this path. As a public service dependency path, it is extracted from the service path.

Similarly, to upgrade to version 3.x, you only need to extract the program path as a public service dependency path.

2) The service path is /work/nebulagraph+graph port, and there are data, etc, logs, pids in this path

 

port specification

1) The port between the clusters is incremented by 5, because the storage copy requires port communication, usually the storage port -1, for example, the two sets of cluster graph ports are 60000 and 60005;

2) The step size between each service port and http and http2 ports is 10000. For example, the graph port is 60000, ws_http_port is 50000, and ws_h2_port is 40000;

3) The difference between the three service ports is 1000. For example, the graph port is 60000, the meta port is 61000, and the storage port is 62000;

60000 graph port; 50000 ws_http_port; 40000 ws_h2_port

61000 meta port; 51000 ws_http_port; 41000 ws_h2_port

62000 storage port; 52000 ws_http_port; 42000 ws_h2_port

 

Operation and maintenance specifications

1) The left prefix of ngdb_ is required to create a space, the default number of shards is 2 times the number of nodes, and the default number of replicas is 2, refer to  CREATE SPACE `ngdb_demo` (partition_num=6,replica_factor=2,charset=utf8,collate=utf8_bin,vid_type =FIXED_STRING(128),atomic_edge=false) ON default ;

2) Grant the DBA role to the business account: GRANT ROLE DBA ON ngdb_demo TO demo_wr ;

3) After building a NebulaGraph cluster, reset the password of the built-in account root, and then package the /work/nebulagraph+graph port path to generate rpm as a standard installation package

Service requests are directly sent to Graph through DNS and gateway services, which is convenient for direct interaction between computing and storage services. Since it is accessed through DNS, Meta node information is not exposed to the outside world, which enables more flexible operation and maintenance, and fewer services are bound by Meta node IP. Operational cost.

This architecture restricts the access of drivers such as Java, and needs to be replaced by other drivers.

4) The basic cluster package is 3 Graph nodes, 3 Meta nodes, and 3 Storage nodes, which can ensure sufficient processing power while ensuring high availability.

The basic cluster is distributed on 3 physical machines, and storage and computing do not require too much network interaction.

 

Cluster deployment automation implementation

In order to deploy services with one click and centrally manage services, we need to use the remote management tool Ansible, which can help us deploy quickly. Generate ansible configuration files according to the port specifications of the three role services.

  • Since the version information is written into the configuration file, in the case of compatibility with multiple versions, only the corresponding judgment needs to be added to the bootstrap.yml file, and the cost of the main program being compatible with multiple versions is very limited.

When deploying an instance, files are distributed according to the graph role, or each node can distribute files individually.

  • According to the three roles, the configuration files are distributed to the destination path respectively, and the final configuration file is generated according to the file naming rules.

more bootstrap.yml
- hosts: graph
  become: yes
  remote_user: root
  tasks:
    - name: init elasticsearch file on data
      command: cp -r /opt/soft/nebulagraph201 {{ nebula_home }}

- hosts: graph
  become: yes
  remote_user: root
  tasks:
    - name: init config graphfile on master {{ version }}
      template: src=/opt/soft/ngdeploy/conf/templates/201graph dest="{{ nebula_etc }}nggraphd.conf" owner=root group=root mode=0755
- hosts: meta
  become: yes
  remote_user: root
  tasks:
    - name: init config metafile on master {{ version }}
      template: src=/opt/soft/ngdeploy/conf/templates/201meta dest="{{ nebula_etc }}ngmetad.conf" owner=root group=root mode=0755
- hosts: storage
  become: yes
  remote_user: root
  tasks:
    - name: init config storagefile on master {{ version }}
      template: src=/opt/soft/ngdeploy/conf/templates/201storage dest="{{ nebula_etc }}ngstoraged.conf" owner=root group=root mode=0755

The distribution of the configuration file is the most critical. There are many variables to be processed. These variables need to be defined in the ansible configuration file in advance. The nebulagraphd path specification and service port need to use graphport, and meta_server_addrs need to use the for loop syntax.

more templates/201graph 
########## basics ##########
--daemonize=true
--pid_file=/work/nebulagraph{{ graphport }}/pids/nebula-graphd.pid
--enable_optimizer=true
########## logging ##########
--log_dir=/work/nebulagraph{{ graphport }}/logs
--minloglevel=0
--v=0
--logbufsecs=0
--redirect_stdout=true
--stdout_log_file=graphd-stdout.log
--stderr_log_file=graphd-stderr.log
--stderrthreshold=2

########## query ##########
--accept_partial_success=false

########## networking ##########
--meta_server_addrs={% for host in groups.graph%}{%if loop.last%}{{ hostvars[host].inventory_hostname }}:{{ hostvars[host].metaport }}{%else%}{{hostvars[host].inventory_hostname }}:{{hostvars[host].metaport}}
,{%endif%}{% endfor %}

--local_ip={{inventory_hostname}}
--listen_netdev=any
--port={{ graphport }}
--reuse_port=false
--listen_backlog=1024
--client_idle_timeout_secs=0
--session_idle_timeout_secs=0
--num_accept_threads=1
--num_netio_threads=0
--num_worker_threads=0
--ws_ip={{inventory_hostname}}
--ws_http_port={{ graph_h1_port }}
--ws_h2_port={{ graph_h2_port }}
--default_charset=utf8
--default_collate=utf8_bin

########## authorization ##########
--enable_authorize=true

########## Authentication ##########
--auth_type=password

Similarly, nebulametad service configuration file path specification and service port need to use metahport, and meta_server_addrs need to use for loop syntax.

more templates/201meta 
########## basics ##########
--daemonize=true
--pid_file=/work/nebulagraph{{graphport}}/pids/nebula-metad.pid
########## logging ##########
--log_dir=/work/nebulagraph{{graphport}}/logs
--minloglevel=0
--v=0
--logbufsecs=0
--redirect_stdout=true
--stdout_log_file=metad-stdout.log
--stderr_log_file=metad-stderr.log
--stderrthreshold=2

########## networking ##########
--meta_server_addrs={% for host in groups.graph%}{%if loop.last%}{{ hostvars[host].inventory_hostname }}:{{ hostvars[host].metaport }}{%else%}{{hostvars[host].inventory_hostname }}:{{hostvars[host].metaport}}
,{%endif%}{% endfor %}

--local_ip={{inventory_hostname}}
--port={{metaport}}
--ws_ip={{inventory_hostname}}
--ws_http_port={{meta_h1_port}}
--ws_h2_port={{meta_h2_port}}
########## storage ##########
--data_path=/work/nebulagraph{{graphport}}/data/meta

########## Misc #########
--default_parts_num=100
--default_replica_factor=1
--heartbeat_interval_secs=10
--timezone_name=CST-8

Similarly, nebulastored service configuration file path specification and service port need to use storageport, meta_server_addrs need to use for loop syntax.

more templates/201graph 
########## basics ##########
--daemonize=true
--pid_file=/work/nebulagraph{{ graphport }}/pids/nebula-graphd.pid
--enable_optimizer=true
########## logging ##########
--log_dir=/work/nebulagraph{{ graphport }}/logs
--minloglevel=0
--v=0
--logbufsecs=0
--redirect_stdout=true
--stdout_log_file=graphd-stdout.log
--stderr_log_file=graphd-stderr.log
--stderrthreshold=2

########## query ##########
--accept_partial_success=false

########## networking ##########
--meta_server_addrs={% for host in groups.graph%}{%if loop.last%}{{ hostvars[host].inventory_hostname }}:{{ hostvars[host].metaport }}{%else%}{{hostvars[host].inventory_hostname }}:{{hostvars[host].metaport}}
,{%endif%}{% endfor %}

--local_ip={{inventory_hostname}}
--listen_netdev=any
--port={{ graphport }}
--reuse_port=false
--listen_backlog=1024
--client_idle_timeout_secs=0
--session_idle_timeout_secs=0
--num_accept_threads=1
--num_netio_threads=0
--num_worker_threads=0
--ws_ip={{inventory_hostname}}
--ws_http_port={{ graph_h1_port }}
--ws_h2_port={{ graph_h2_port }}
--default_charset=utf8
--default_collate=utf8_bin

########## authorization ##########
--enable_authorize=true

########## Authentication ##########
--auth_type=password

When you need to deploy a new cluster, you need to generate an ansible configuration file according to the rules and destination server information, then call ansible-playbook and execute it according to the behavior defined in bootstrap.yml.

After the deployment is complete, you need to start the script file of start.yml in turn according to the service role and define the start commands and configuration files of the three services in advance.

Call ansible-playbook and execute the start commands of the three services in sequence according to the script file of start.yml.

 

> > > Visual Graph Discovery Platform

Depending on the setting of placing the target host on the web platform, we only need to provide a common web platform for the development of multiple projects, which reduces the number of components in the NebulaGraph cluster, which is different from the standard architecture of ELK.

Developers can manage data visually through NebulaGraph Studio, easily implement data import and export, and facilitate users to explore data relationships. The point-edge relationship is directly presented, making it more intuitive to explore the relationship between graph data.

The above are some of our experiences in the process of large-scale management and maintenance of NebulaGraph clusters, and we hope to be of some help to you.

Exchange graph database technology? To join the NebulaGraph exchange group, please fill in your NebulaGraph business card first , and the Nebula assistant will pull you into the group~~
 

Official website: https://nebula-graph.com.cn

GitHub:https://github.com/vesoft-inc/nebula

Free and open source, you can click Star(8K) in the upper right corner to support/favorite~

{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4169309/blog/5581378
Recommended