From 2cce773589d0e2dda35d1134878533e20e3c6aaa Mon Sep 17 00:00:00 2001 From: "peng.xu" Date: Tue, 26 Nov 2019 13:34:32 +0800 Subject: [PATCH] [skip ci](shards): add all_in_one_with_mysql --- shards/all_in_one_with_mysql/all_in_one.yml | 77 +++++++++++++++++++++ shards/all_in_one_with_mysql/mysqld.cnf | 28 ++++++++ shards/all_in_one_with_mysql/probe_test.py | 25 +++++++ shards/all_in_one_with_mysql/ro_server.yml | 42 +++++++++++ shards/all_in_one_with_mysql/wr_server.yml | 41 +++++++++++ 5 files changed, 213 insertions(+) create mode 100644 shards/all_in_one_with_mysql/all_in_one.yml create mode 100644 shards/all_in_one_with_mysql/mysqld.cnf create mode 100644 shards/all_in_one_with_mysql/probe_test.py create mode 100644 shards/all_in_one_with_mysql/ro_server.yml create mode 100644 shards/all_in_one_with_mysql/wr_server.yml diff --git a/shards/all_in_one_with_mysql/all_in_one.yml b/shards/all_in_one_with_mysql/all_in_one.yml new file mode 100644 index 00000000..6619635f --- /dev/null +++ b/shards/all_in_one_with_mysql/all_in_one.yml @@ -0,0 +1,77 @@ +version: "2.3" +services: + milvus-mysql: + restart: always + image: mysql:5.7 + volumes: + - ./mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf + - ./metadata:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: 'milvusroot' + MYSQL_DATABASE: 'milvus' + healthcheck: + test: ["CMD", "sleep", "5"] + interval: 1s + timeout: 10s + retries: 2 + + milvus_wr: + runtime: nvidia + restart: always + image: milvusdb/milvus + volumes: + - /tmp/milvus/db:/opt/milvus/db + - ./wr_server.yml:/opt/milvus/conf/server_config.yaml + depends_on: + milvus-mysql: + condition: service_healthy + + milvus_ro: + runtime: nvidia + restart: always + image: milvusdb/milvus + volumes: + - /tmp/milvus/db:/opt/milvus/db + - ./ro_server.yml:/opt/milvus/conf/server_config.yaml + depends_on: + - milvus-mysql + - milvus_wr + + jaeger: + restart: always + image: jaegertracing/all-in-one:1.14 + ports: + - "0.0.0.0:5775:5775/udp" + - "0.0.0.0:16686:16686" + - "0.0.0.0:9441:9441" + environment: + COLLECTOR_ZIPKIN_HTTP_PORT: 9411 + + mishards: + restart: always + image: milvusdb/mishards + ports: + - "0.0.0.0:19531:19531" + - "0.0.0.0:19532:19532" + volumes: + - /tmp/milvus/db:/tmp/milvus/db + # - /tmp/mishards_env:/source/mishards/.env + command: ["python", "mishards/main.py"] + environment: + FROM_EXAMPLE: 'true' + SQLALCHEMY_DATABASE_URI: mysql+pymysql://root:milvusroot@milvus-mysql:3306/milvus?charset=utf8mb4 + DEBUG: 'true' + SERVER_PORT: 19531 + WOSERVER: tcp://milvus_wr:19530 + DISCOVERY_PLUGIN_PATH: static + DISCOVERY_STATIC_HOSTS: milvus_wr,milvus_ro + TRACER_CLASS_NAME: jaeger + TRACING_SERVICE_NAME: mishards-demo + TRACING_REPORTING_HOST: jaeger + TRACING_REPORTING_PORT: 5775 + + depends_on: + - milvus_wr + - milvus_ro + - milvus-mysql + - jaeger diff --git a/shards/all_in_one_with_mysql/mysqld.cnf b/shards/all_in_one_with_mysql/mysqld.cnf new file mode 100644 index 00000000..5f636767 --- /dev/null +++ b/shards/all_in_one_with_mysql/mysqld.cnf @@ -0,0 +1,28 @@ +[mysqld] +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +datadir = /var/lib/mysql +log-error = /var/log/mysql/error.log +bind-address = 0.0.0.0 +symbolic-links=0 +character-set-server = utf8mb4 +collation-server = utf8mb4_unicode_ci +init_connect='SET NAMES utf8mb4' +skip-character-set-client-handshake = true +max_connections = 1000 +wait_timeout = 31536000 +table_open_cache = 128 +external-locking = FALSE +binlog_cache_size = 1M +max_heap_table_size = 8M +tmp_table_size = 16M +read_rnd_buffer_size = 8M +sort_buffer_size = 8M +join_buffer_size = 8M +thread_cache_size = 32 +query_cache_size = 64M +innodb_buffer_pool_size = 64M +innodb_flush_log_at_trx_commit = 0 +innodb_log_buffer_size = 2M +max_allowed_packet=64M +explicit_defaults_for_timestamp=true \ No newline at end of file diff --git a/shards/all_in_one_with_mysql/probe_test.py b/shards/all_in_one_with_mysql/probe_test.py new file mode 100644 index 00000000..62504659 --- /dev/null +++ b/shards/all_in_one_with_mysql/probe_test.py @@ -0,0 +1,25 @@ +from milvus import Milvus + +RED = '\033[0;31m' +GREEN = '\033[0;32m' +ENDC = '' + + +def test(host='127.0.0.1', port=19531): + client = Milvus() + try: + status = client.connect(host=host, port=port) + if status.OK(): + print('{}Pass: Connected{}'.format(GREEN, ENDC)) + return 0 + else: + print('{}Error: {}{}'.format(RED, status, ENDC)) + return 1 + except Exception as exc: + print('{}Error: {}{}'.format(RED, exc, ENDC)) + return 1 + + +if __name__ == '__main__': + import fire + fire.Fire(test) diff --git a/shards/all_in_one_with_mysql/ro_server.yml b/shards/all_in_one_with_mysql/ro_server.yml new file mode 100644 index 00000000..768fafb1 --- /dev/null +++ b/shards/all_in_one_with_mysql/ro_server.yml @@ -0,0 +1,42 @@ +server_config: + address: 0.0.0.0 # milvus server ip address (IPv4) + port: 19530 # port range: 1025 ~ 65534 + deploy_mode: cluster_readonly # deployment type: single, cluster_readonly, cluster_writable + time_zone: UTC+8 + +db_config: + primary_path: /opt/milvus # path used to store data and meta + secondary_path: # path used to store data only, split by semicolon + + backend_url: mysql://root:milvusroot@milvus-mysql:3306/milvus + # URI format: dialect://username:password@host:port/database + # Keep 'dialect://:@:/', and replace other texts with real values + # Replace 'dialect' with 'mysql' or 'sqlite' + + insert_buffer_size: 1 # GB, maximum insert buffer size allowed + # sum of insert_buffer_size and cpu_cache_capacity cannot exceed total memory + + preload_table: # preload data at startup, '*' means load all tables, empty value means no preload + # you can specify preload tables like this: table1,table2,table3 + +metric_config: + enable_monitor: false # enable monitoring or not + collector: prometheus # prometheus + prometheus_config: + port: 8080 # port prometheus uses to fetch metrics + +cache_config: + cpu_cache_capacity: 4 # GB, CPU memory used for cache + cpu_cache_threshold: 0.85 # percentage of data that will be kept when cache cleanup is triggered + gpu_cache_capacity: 1 # GB, GPU memory used for cache + gpu_cache_threshold: 0.85 # percentage of data that will be kept when cache cleanup is triggered + cache_insert_data: false # whether to load inserted data into cache + +engine_config: + use_blas_threshold: 800 # if nq < use_blas_threshold, use SSE, faster with fluctuated response times + # if nq >= use_blas_threshold, use OpenBlas, slower with stable response times + +resource_config: + search_resources: # define the GPUs used for search computation, valid value: gpux + - gpu0 + index_build_device: gpu0 # GPU used for building index diff --git a/shards/all_in_one_with_mysql/wr_server.yml b/shards/all_in_one_with_mysql/wr_server.yml new file mode 100644 index 00000000..b2332532 --- /dev/null +++ b/shards/all_in_one_with_mysql/wr_server.yml @@ -0,0 +1,41 @@ +server_config: + address: 0.0.0.0 # milvus server ip address (IPv4) + port: 19530 # port range: 1025 ~ 65534 + deploy_mode: cluster_writable # deployment type: single, cluster_readonly, cluster_writable + time_zone: UTC+8 + +db_config: + primary_path: /opt/milvus # path used to store data and meta + secondary_path: # path used to store data only, split by semicolon + + backend_url: mysql://root:milvusroot@milvus-mysql:3306/milvus # URI format: dialect://username:password@host:port/database + # Keep 'dialect://:@:/', and replace other texts with real values + # Replace 'dialect' with 'mysql' or 'sqlite' + + insert_buffer_size: 2 # GB, maximum insert buffer size allowed + # sum of insert_buffer_size and cpu_cache_capacity cannot exceed total memory + + preload_table: # preload data at startup, '*' means load all tables, empty value means no preload + # you can specify preload tables like this: table1,table2,table3 + +metric_config: + enable_monitor: false # enable monitoring or not + collector: prometheus # prometheus + prometheus_config: + port: 8080 # port prometheus uses to fetch metrics + +cache_config: + cpu_cache_capacity: 2 # GB, CPU memory used for cache + cpu_cache_threshold: 0.85 # percentage of data that will be kept when cache cleanup is triggered + gpu_cache_capacity: 2 # GB, GPU memory used for cache + gpu_cache_threshold: 0.85 # percentage of data that will be kept when cache cleanup is triggered + cache_insert_data: false # whether to load inserted data into cache + +engine_config: + use_blas_threshold: 800 # if nq < use_blas_threshold, use SSE, faster with fluctuated response times + # if nq >= use_blas_threshold, use OpenBlas, slower with stable response times + +resource_config: + search_resources: # define the GPUs used for search computation, valid value: gpux + - gpu0 + index_build_device: gpu0 # GPU used for building index -- GitLab