BanyanDB: support TLS connection and configuration. (#12639)

This commit is contained in:
Wan Kai 2024-09-24 16:24:17 +08:00 committed by GitHub
parent 15ad71d633
commit 7d1b65c639
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 215 additions and 6 deletions

View File

@ -359,6 +359,8 @@ jobs:
- name: BanyanDB
config: test/e2e-v2/cases/storage/banyandb/e2e.yaml
- name: BanyanDB TLS
config: test/e2e-v2/cases/storage/banyandb/tls/e2e.yaml
- name: Storage H2
config: test/e2e-v2/cases/storage/h2/e2e.yaml
- name: Storage MySQL

View File

@ -42,6 +42,7 @@ header:
- '**/*.ini'
- '**/*.crt'
- '**/*.pem'
- '**/*.key'
- '**/*.txt'
- 'LICENSE'
- 'NOTICE'

View File

@ -70,6 +70,7 @@
* Add Component ID(5022) for the GoFrame framework.
* Bump up protobuf java dependencies to 3.25.5.
* BanyanDB: support using native term searching for `keyword` in query `findEndpoint` and `getAlarm`.
* BanyanDB: support TLS connection and configuration.
#### UI

View File

@ -149,6 +149,10 @@ The Configuration Vocabulary lists all available configurations provided by `app
| - | - | superDatasetShardsFactor | Shards Factor for a super dataset record, i.e. Shard number of a super dataset is recordShardsNumber*superDatasetShardsFactor. | SW_STORAGE_BANYANDB_SUPERDATASET_SHARDS_FACTOR | 2 |
| - | - | concurrentWriteThreads | Concurrent consumer threads for batch writing. | SW_STORAGE_BANYANDB_CONCURRENT_WRITE_THREADS | 15 |
| - | - | profileTaskQueryMaxSize | Max size of ProfileTask to be fetched. | SW_STORAGE_BANYANDB_PROFILE_TASK_QUERY_MAX_SIZE | 200 |
| - | - | segmentIntervalDays | Data is stored in BanyanDB in segments. A segment is a time range of data.The segment interval is the time range of a segment.The value should be less or equal to data TTL relevant settings. | SW_STORAGE_BANYANDB_SEGMENT_INTERVAL_DAYS | 1 |
| - | - | superDatasetSegmentIntervalDays | The super dataset segment interval is the time range of a segment in the super dataset. | SW_STORAGE_BANYANDB_SUPER_DATASET_SEGMENT_INTERVAL_DAYS | 1 |
| - | - | specificGroupSettings | Specific groups settings. | SW_STORAGE_BANYANDB_SPECIFIC_GROUP_SETTINGS | - |
| - | - | sslTrustCAPath | If the BanyanDB server is configured with TLS, config the TLS cert file path and open tls connection. | SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH | - |
| agent-analyzer | default | Agent Analyzer. | SW_AGENT_ANALYZER | default | |
| - | - | traceSamplingPolicySettingsFile | The sampling policy including `sampling rate` and `the threshold of trace segment latency` can be configured by the `traceSamplingPolicySettingsFile` file. | SW_TRACE_SAMPLING_POLICY_SETTINGS_FILE | `trace-sampling-policy-settings.yml` |
| - | - | slowDBAccessThreshold | The slow database access threshold (in milliseconds). | SW_SLOW_DB_THRESHOLD | default:200,mongodb:100 |

View File

@ -49,6 +49,8 @@ storage:
# Please refer to https://github.com/apache/skywalking-banyandb/blob/${BANYANDB_RELEASE}/docs/crud/group.md#create-operation
# for group setting details.
specificGroupSettings: ${SW_STORAGE_BANYANDB_SPECIFIC_GROUP_SETTINGS:""}
# If the BanyanDB server is configured with TLS, config the TLS cert file path and open tls connection.
sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
```
BanyanDB Server supports two installation modes: standalone and cluster. The standalone mode is suitable for small-scale deployments, while the cluster mode is suitable for large-scale deployments.

View File

@ -220,7 +220,7 @@ storage:
# Targets is the list of BanyanDB servers, separated by commas.
# Each target is a BanyanDB server in the format of `host:port`
# The host is the IP address or domain name of the BanyanDB server, and the port is the port number of the BanyanDB server.
targets: ${SW_STORAGE_BANYANDB_TARGETS:127.0.0.1:17912}
targets: ${SW_STORAGE_BANYANDB_TARGETS:localhost:17912}
# The max number of records in a bulk write request.
# Bigger value can improve the write performance, but also increase the OAP and BanyanDB Server memory usage.
maxBulkSize: ${SW_STORAGE_BANYANDB_MAX_BULK_SIZE:10000}
@ -254,9 +254,11 @@ storage:
superDatasetSegmentIntervalDays: ${SW_STORAGE_BANYANDB_SUPER_DATASET_SEGMENT_INTERVAL_DAYS:1}
# Specific groups settings.
# For example, {"group1": {"blockIntervalHours": 4, "segmentIntervalDays": 1}}
# Please refer to https://github.com/apache/skywalking-banyandb/blob/${BANYANDB_RELEASE}/docs/crud/group.md#create-operation
# Please refer to https://github.com/apache/skywalking-banyandb/blob/${BANYANDB_RELEASE}/docs/interacting/bydbctl/schema/group.md#create-operation
# for group setting details.
specificGroupSettings: ${SW_STORAGE_BANYANDB_SPECIFIC_GROUP_SETTINGS:""}
# If the BanyanDB server is configured with TLS, config the TLS cert file path and open tls connection.
sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
agent-analyzer:
selector: ${SW_AGENT_ANALYZER:default}

View File

@ -25,6 +25,7 @@ import org.apache.skywalking.banyandb.v1.client.MeasureBulkWriteProcessor;
import org.apache.skywalking.banyandb.v1.client.MeasureQuery;
import org.apache.skywalking.banyandb.v1.client.MeasureQueryResponse;
import org.apache.skywalking.banyandb.v1.client.MeasureWrite;
import org.apache.skywalking.banyandb.v1.client.Options;
import org.apache.skywalking.banyandb.v1.client.StreamBulkWriteProcessor;
import org.apache.skywalking.banyandb.v1.client.StreamQuery;
import org.apache.skywalking.banyandb.v1.client.StreamQueryResponse;
@ -58,9 +59,11 @@ public class BanyanDBStorageClient implements Client, HealthCheckable {
private final DelegatedHealthChecker healthChecker = new DelegatedHealthChecker();
private final int flushTimeout;
public BanyanDBStorageClient(int flushTimeout, String... targets) {
this.client = new BanyanDBClient(targets);
this.flushTimeout = flushTimeout;
public BanyanDBStorageClient(BanyanDBStorageConfig config) {
Options options = new Options();
options.setSslTrustCAPath(config.getSslTrustCAPath());
this.client = new BanyanDBClient(config.getTargetArray(), options);
this.flushTimeout = config.getFlushTimeout();
}
@Override

View File

@ -93,6 +93,11 @@ public class BanyanDBStorageConfig extends ModuleConfig {
*/
private String specificGroupSettings;
/**
* If the BanyanDB server is configured with TLS, config the TLS cert file path and open tls connection.
*/
private String sslTrustCAPath = "";
public String[] getTargetArray() {
return Iterables.toArray(Splitter.on(",").omitEmptyStrings().trimResults().split(this.targets), String.class);
}

View File

@ -117,7 +117,7 @@ public class BanyanDBStorageProvider extends ModuleProvider {
public void prepare() throws ServiceNotProvidedException, ModuleStartException {
this.registerServiceImplementation(StorageBuilderFactory.class, new StorageBuilderFactory.Default());
this.client = new BanyanDBStorageClient(config.getFlushTimeout(), config.getTargetArray());
this.client = new BanyanDBStorageClient(config);
this.modelInstaller = new BanyanDBIndexInstaller(client, getManager(), this.config);
// Stream

View File

@ -0,0 +1,69 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: '2.1'
services:
banyandb:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: banyandb
volumes:
- ./tls:/tls
command: standalone --stream-root-path /tmp/stream-data --measure-root-path /tmp/measure-data --tls=true --key-file=/tls/cert.key --cert-file=/tls/cert.crt --http-grpc-cert-file=/tls/ca.crt
networks:
- e2e
oap:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: oap
volumes:
- ./tls/cert.crt:/tls/cert.crt
environment:
SW_STORAGE: banyandb
SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH: /tls/cert.crt
ports:
- 12800
depends_on:
banyandb:
condition: service_healthy
provider:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: provider
ports:
- 9090
networks:
- e2e
depends_on:
oap:
condition: service_healthy
consumer:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: consumer
ports:
- 9092
depends_on:
oap:
condition: service_healthy
provider:
condition: service_healthy
networks:
e2e:

View File

@ -0,0 +1,50 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is used to show how to write configuration files and can be used to test.
setup:
env: compose
file: docker-compose.yml
timeout: 20m
init-system-environment: ../../../../script/env
steps:
- name: set PATH
command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
- name: install yq
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq
- name: install swctl
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl
trigger:
action: http
interval: 5s
times: 40
url: http://${consumer_host}:${consumer_9092}/users
method: POST
body: '{"id":"123","name":"skywalking"}'
headers:
"Content-Type": "application/json"
verify:
# verify with retry strategy
retry:
# max retry count
count: 20
# the interval between two retries, in millisecond.
interval: 10s
cases:
- includes:
- ../../storage-cases.yaml

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDYzCCAkugAwIBAgIUAJ+VBTfduocXTnjwAAt5/xLcuhcwDQYJKoZIhvcNAQEL
BQAwQDELMAkGA1UEBhMCQ04xDTALBgNVBAgMBFRlc3QxDTALBgNVBAcMBFRlc3Qx
EzARBgNVBAoMClNreVdhbGtpbmcwIBcNMjQwOTE5MDIxNjEzWhgPMjEyNDA4MjYw
MjE2MTNaMEAxCzAJBgNVBAYTAkNOMQ0wCwYDVQQIDARUZXN0MQ0wCwYDVQQHDARU
ZXN0MRMwEQYDVQQKDApTa3lXYWxraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEAy1DBH5bTwGj+hGewLPJ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