centos系统下安装milvus以图搜图程序

229次阅读

共计 12584 个字符,预计需要花费 32 分钟才能阅读完成。

1.Milvus 系统简介

Milvus 在非结构化数据处理中的应用非常强大。Milvus 向量相似度检索引擎可以兼容各种深度学习平台,搜索十亿向量仅毫秒响应。

centos 系统下安装 milvus 以图搜图程序

2. 假设你已经购买了 centos 服务器

3. 安装 docker

yum install docker-ce docker-ce-cli containerd.io 
运行并设置自启动 

systemctl start docker
systemctl enable docker

4. 使用 WinScp 连接服务器

centos 系统下安装 milvus 以图搜图程序

5. 创建文件

在 root 下创建 milvus 文件夹,并在 milvus 下面创建以下文件夹:

centos 系统下安装 milvus 以图搜图程序

6. 在 conf 文件夹里面放入 server_config.yaml 文件,文件内容如下

Copyright (C) 2019-2020 Zilliz. All rights reserved.

#

Licensed 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: 0.5

———————-+————————————————————+————+—————–+

Cluster Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

enable | If runinng with Mishards, set true, otherwise false. | Boolean | false |

———————-+————————————————————+————+—————–+

role | Milvus deployment role: rw / ro | role | rw |

———————-+————————————————————+————+—————–+

cluster:
enable: false
role: rw

———————-+————————————————————+————+—————–+

General Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

time_zone | Use UTC-x or UTC+x to specify a time zone. | Timezone | UTC+8 |

———————-+————————————————————+————+—————–+

meta_uri | URI for metadata storage, using SQLite (for single server | URL | sqlite://:@:/ |

| Milvus) or MySQL (for distributed cluster Milvus). | | |

| Format: dialect://username:password@host:port/database | | |

| Keep ‘dialect://:@:/’, ‘dialect’ can be either ‘sqlite’ or | | |

| ‘mysql’, replace other texts with real values. | | |

———————-+————————————————————+————+—————–+

general:
timezone: UTC+8
meta_uri: sqlite://:@:/

———————-+————————————————————+————+—————–+

Network Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

bind.address | IP address that Milvus server monitors. | IP | 0.0.0.0 |

———————-+————————————————————+————+—————–+

bind.port | Port that Milvus server monitors. Port range (1024, 65535) | Integer | 19530 |

———————-+————————————————————+————+—————–+

http.enable | Enable web server or not. | Boolean | true |

———————-+————————————————————+————+—————–+

http.port | Port that Milvus web server monitors. | Integer | 19121 |

| Port range (1024, 65535) | | |

———————-+————————————————————+————+—————–+

network:
bind.address: 0.0.0.0
bind.port: 19530
http.enable: true
http.port: 19121

———————-+————————————————————+————+—————–+

Storage Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

path | Path used to save meta data, vector data and index data. | Path | /var/lib/milvus |

———————-+————————————————————+————+—————–+

auto_flush_interval | The interval, in seconds, at which Milvus automatically | Integer | 1 (s) |

| flushes data to disk. | | |

| 0 means disable the regular flush. | | |

———————-+————————————————————+————+—————–+

storage:
path: /var/lib/milvus
auto_flush_interval: 1

———————-+————————————————————+————+—————–+

WAL Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

enable | Whether to enable write-ahead logging (WAL) in Milvus. | Boolean | true |

| If WAL is enabled, Milvus writes all data changes to log | | |

| files in advance before implementing data changes. WAL | | |

| ensures the atomicity and durability for Milvus operations.| | |

———————-+————————————————————+————+—————–+

recovery_error_ignore| Whether to ignore logs with errors that happens during WAL | Boolean | false |

| recovery. If true, when Milvus restarts for recovery and | | |

| there are errors in WAL log files, log files with errors | | |

| are ignored. If false, Milvus does not restart when there | | |

| are errors in WAL log files. | | |

———————-+————————————————————+————+—————–+

buffer_size | Sum total of the read buffer and the write buffer in MBs. | Integer | 256 (MB) |

| buffer_size must be in range 64, 4096. | | |

| If the value you specified is out of range, Milvus | | |

| automatically uses the boundary value closest to the | | |

| specified value. It is recommended you set buffer_size to | | |

| a value greater than the inserted data size of a single | | |

| insert operation for better performance. | | |

———————-+————————————————————+————+—————–+

path | Location of WAL log files. | String | |

———————-+————————————————————+————+—————–+

wal:
enable: true
recovery_error_ignore: false
buffer_size: 256MB
path: /var/lib/milvus/wal

———————-+————————————————————+————+—————–+

Cache Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

cache_size | The size of CPU memory used for caching data for faster | Integer | 4 (GB) |

| query. The sum of ‘cpu_cache_capacity’ and | | |

| ‘insert_buffer_size’ must be less than system memory size. | | |

———————-+————————————————————+————+—————–+

insert_buffer_size | Buffer size used for data insertion. | Integer | 1 (GB) |

| The sum of ‘insert_buffer_size’ and ‘cpu_cache_capacity’ | | |

| must be less than system memory size. | | |

———————-+————————————————————+————+—————–+

preload_collection | A comma-separated list of collection names that need to | StringList | |

| be pre-loaded when Milvus server starts up. | | |

| ‘*’ means preload all existing tables (single-quote or | | |

| double-quote required). | | |

———————-+————————————————————+————+—————–+

cache:
cache_size: 256MB
insert_buffer_size: 256MB
preload_collection:

———————-+————————————————————+————+—————–+

GPU Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

enable | Enable GPU resources or not. | Boolean | false |

———————-+————————————————————+————+—————–+

cache_size | The size of GPU memory per card used for cache. | Integer | 1 (GB) |

———————-+————————————————————+————+—————–+

gpu_search_threshold | A Milvus performance tuning parameter. This value will be | Integer | 1000 |

| compared with ‘nq’ to decide if the search computation will| | |

| be executed on GPUs only. | | |

| If nq >= gpu_search_threshold, the search computation will | | |

| be executed on GPUs only; | | |

| if nq < gpu_search_threshold, the search computation will | | |

| be executed on CPUs only. | | |

| The SQ8H index is special, if nq < gpu_search_threshold, | | |

| the search will be executed on both CPUs and GPUs. | | |

———————-+————————————————————+————+—————–+

search_resources | The list of GPU devices used for search computation. | DeviceList | gpu0 |

| Must be in format gpux. | | |

———————-+————————————————————+————+—————–+

build_index_resources| The list of GPU devices used for index building. | DeviceList | gpu0 |

| Must be in format gpux. | | |

———————-+————————————————————+————+—————–+

gpu:
enable: false
cache_size: 256MB
gpu_search_threshold: 1000
search_devices:
– gpu0
build_index_devices:
– gpu0

———————-+————————————————————+————+—————–+

FPGA Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

enable | Use FPGA devices or not. | Boolean | false |

———————-+————————————————————+————+—————–+

search_devices | The list of FPGA devices used for search computation. | DeviceList | fpga0 |

| Must be in format fpgax. | | |

———————-+————————————————————+————+—————–+

fpga:
enable: false
search_devices:
– fpga0

———————-+————————————————————+————+—————–+

Logs Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

level | Log level in Milvus. Must be one of debug, info, warning, | String | debug |

| error, fatal | | |

———————-+————————————————————+————+—————–+

trace.enable | Whether to enable trace level logging in Milvus. | Boolean | true |

———————-+————————————————————+————+—————–+

path | Absolute path to the folder holding the log files. | String | |

———————-+————————————————————+————+—————–+

max_log_file_size | The maximum size of each log file, size range [512, 4096] | Integer | 1024 (MB) |

———————-+————————————————————+————+—————–+

log_rotate_num | The maximum number of log files that Milvus keeps for each | Integer | 0 |

| logging level, num range [0, 1024], 0 means unlimited. | | |

———————-+————————————————————+————+—————–+

log_to_stdout | Whether to write logs to standard output in Milvus. | Boolean | false |

———————-+————————————————————+————+—————–+

log_to_file | Whether to write logs to files in Milvus | Boolean | true |

———————-+————————————————————+————+—————–+

logs:
level: debug
trace.enable: true
path: /var/lib/milvus/logs
max_log_file_size: 256MB
log_rotate_num: 0
log_to_stdout: false
log_to_file: true

———————-+————————————————————+————+—————–+

Metric Config | Description | Type | Default |

———————-+————————————————————+————+—————–+

enable | Enable monitoring function or not. | Boolean | false |

———————-+————————————————————+————+—————–+

address | Pushgateway address | IP | 127.0.0.1 +

———————-+————————————————————+————+—————–+

port | Pushgateway port, port range (1024, 65535) | Integer | 9091 |

———————-+————————————————————+————+—————–+

metric:
enable: false
address: 127.0.0.1
port: 9091

7. 在 pic 文件夹下面放入图片

centos 系统下安装 milvus 以图搜图程序

8. 打开 putty 连接服务器

centos 系统下安装 milvus 以图搜图程序

9. 依次在 putty 中输入以下内容

docker run -d --name milvus_1 \
-p 19530:19530 \
-p 19121:19121 \
-v /root/milvus/db:/var/lib/milvus/db \
-v /root/milvus/conf:/var/lib/milvus/conf \
-v /root/milvus/logs:/var/lib/milvus/logs \
-v /root/milvus/wal:/var/lib/milvus/wal \
milvusdb/milvus:1.0.0-cpu-d030521-1ea92e 
docker run -d --name image_search \
-v /root/milvus/pic:/tmp/pic1 \
-p 35000:5000 \
-e "DATA_PATH=/tmp/images-data" \
-e "MILVUS_HOST= 你的服务器 ip 地址" \
milvusbootcamp/pic-search-webserver:1.0
docker run --name milvus_image_search_web -d --rm -p 8001:80 \
-e API_URL=http:// 你的服务器 ip 地址:35000 \
milvusbootcamp/pic-search-webclient:1.0

10. 打开浏览器并输入:你的服务器 ip:8001

在框中输入红字字内容,并按 + 号

centos 系统下安装 milvus 以图搜图程序

点了以后反应很慢,要等几分钟,等图片处理完毕就可以进行以图搜图

正文完
 0
qxm@qxm.cn
版权声明:本站原创文章,由 qxm@qxm.cn 于2024-07-24发表,共计12584字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。