orztv commited on
Commit
6e3f2ed
·
1 Parent(s): 3f73fdd
Files changed (1) hide show
  1. run.sh +43 -31
run.sh CHANGED
@@ -66,6 +66,7 @@ start_qdrant() {
66
  mkdir -p /home/pn/.n8n/qdrant/storage
67
  mkdir -p /home/pn/.n8n/qdrant/config
68
  mkdir -p /home/pn/.n8n/qdrant/snapshots
 
69
 
70
  # 设置正确的权限
71
  chmod -R 755 /home/pn/.n8n/qdrant
@@ -75,22 +76,51 @@ start_qdrant() {
75
  cat > /home/pn/.n8n/qdrant/config/config.yaml <<EOF
76
  service:
77
  host: 0.0.0.0
78
- port: 6333
79
  grpc_port: 6334
80
- api_key: "api-key"
 
 
 
81
 
82
  storage:
83
  storage_path: /home/pn/.n8n/qdrant/storage
84
  snapshots_path: /home/pn/.n8n/qdrant/snapshots
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
- log_level: INFO
 
 
 
 
 
 
87
  EOF
88
 
89
  # 确保配置文件有正确的权限
90
  chmod 644 /home/pn/.n8n/qdrant/config/config.yaml
91
 
92
  # 使用配置文件启动 Qdrant
93
- qdrant --config-path /home/pn/.n8n/qdrant/config/config.yaml > /home/pn/.n8n/qdrant/qdrant.log 2>&1 &
94
 
95
  # 等待 Qdrant 启动
96
  local timeout=30
@@ -99,40 +129,26 @@ EOF
99
  while [ $SECONDS -lt $end ]; do
100
  if curl -s http://localhost:6333/health >/dev/null; then
101
  echo "Qdrant server started successfully"
102
- # 测试 Qdrant API 连接
103
- echo "Testing Qdrant API..."
104
- # 创建测试集合
105
- curl -X PUT 'http://localhost:6333/collections/test_collection' \
106
- -H 'Content-Type: application/json' \
107
- -d '{
108
- "vectors": {
109
- "size": 4,
110
- "distance": "Cosine"
111
- }
112
- }'
113
- # 删除测试集合
114
- curl -X DELETE 'http://localhost:6333/collections/test_collection'
115
- echo "Qdrant API test successful"
116
  return 0
117
  fi
118
  echo "Waiting for Qdrant to start..."
119
  sleep 1
120
 
121
  # 检查是否有错误日志
122
- if grep -i "error" /home/pn/.n8n/qdrant/qdrant.log >/dev/null 2>&1; then
123
  echo "Error found in Qdrant logs:"
124
- tail -n 10 /home/pn/.n8n/qdrant/qdrant.log
125
- # 显示目录权限
126
- echo "Directory permissions:"
127
- ls -la /home/pn/.n8n/qdrant/
128
  fi
129
  done
130
 
131
  echo "Failed to start Qdrant server"
132
  echo "Last 10 lines of Qdrant log:"
133
- tail -n 10 /home/pn/.n8n/qdrant/qdrant.log
134
- echo "Directory permissions:"
135
- ls -la /home/pn/.n8n/qdrant/
136
  exit 1
137
  }
138
 
@@ -143,11 +159,7 @@ check_services() {
143
  # 检查 Redis
144
  echo "Redis 状态:"
145
  redis-cli info | grep 'used_memory\|connected_clients\|total_connections_received'
146
-
147
- # 检查 Redis 队列
148
- echo "Redis 队列状态:"
149
- redis-cli keys "${N8N_QUEUE_BULL_REDIS_PREFIX}*"
150
-
151
  # 检查 Qdrant
152
  echo "Qdrant 状态:"
153
  if curl -s http://localhost:6333/metrics >/dev/null; then
 
66
  mkdir -p /home/pn/.n8n/qdrant/storage
67
  mkdir -p /home/pn/.n8n/qdrant/config
68
  mkdir -p /home/pn/.n8n/qdrant/snapshots
69
+ mkdir -p /home/pn/.n8n/qdrant/logs
70
 
71
  # 设置正确的权限
72
  chmod -R 755 /home/pn/.n8n/qdrant
 
76
  cat > /home/pn/.n8n/qdrant/config/config.yaml <<EOF
77
  service:
78
  host: 0.0.0.0
79
+ http_port: 6333
80
  grpc_port: 6334
81
+ enable_cors: true
82
+ enable_tls: false
83
+ max_request_size_mb: 64
84
+ max_workers: 0
85
 
86
  storage:
87
  storage_path: /home/pn/.n8n/qdrant/storage
88
  snapshots_path: /home/pn/.n8n/qdrant/snapshots
89
+ on_disk_payload: true
90
+
91
+ performance:
92
+ max_search_threads: 0
93
+ max_optimization_threads: 0
94
+
95
+ optimizers:
96
+ deleted_threshold: 0.2
97
+ vacuum_min_vector_number: 1000
98
+ default_segment_number: 0
99
+ max_segment_size_kb: null
100
+ indexing_threshold_kb: 20000
101
+ flush_interval_sec: 5
102
+
103
+ hnsw_index:
104
+ m: 16
105
+ ef_construct: 100
106
+ full_scan_threshold_kb: 10000
107
+ max_indexing_threads: 0
108
+ on_disk: false
109
 
110
+ logger:
111
+ on_disk:
112
+ enabled: true
113
+ log_file: /home/pn/.n8n/qdrant/logs/qdrant.log
114
+ log_level: INFO
115
+
116
+ telemetry_disabled: true
117
  EOF
118
 
119
  # 确保配置文件有正确的权限
120
  chmod 644 /home/pn/.n8n/qdrant/config/config.yaml
121
 
122
  # 使用配置文件启动 Qdrant
123
+ qdrant --config-path /home/pn/.n8n/qdrant/config/config.yaml > /home/pn/.n8n/qdrant/logs/startup.log 2>&1 &
124
 
125
  # 等待 Qdrant 启动
126
  local timeout=30
 
129
  while [ $SECONDS -lt $end ]; do
130
  if curl -s http://localhost:6333/health >/dev/null; then
131
  echo "Qdrant server started successfully"
132
+ # 输出版本和状态信息
133
+ echo "Qdrant version:"
134
+ curl -s http://localhost:6333/version
135
+ echo -e "\nQdrant collections:"
136
+ curl -s http://localhost:6333/collections
 
 
 
 
 
 
 
 
 
137
  return 0
138
  fi
139
  echo "Waiting for Qdrant to start..."
140
  sleep 1
141
 
142
  # 检查是否有错误日志
143
+ if grep -i "error" /home/pn/.n8n/qdrant/logs/startup.log >/dev/null 2>&1; then
144
  echo "Error found in Qdrant logs:"
145
+ tail -n 10 /home/pn/.n8n/qdrant/logs/startup.log
 
 
 
146
  fi
147
  done
148
 
149
  echo "Failed to start Qdrant server"
150
  echo "Last 10 lines of Qdrant log:"
151
+ tail -n 10 /home/pn/.n8n/qdrant/logs/startup.log
 
 
152
  exit 1
153
  }
154
 
 
159
  # 检查 Redis
160
  echo "Redis 状态:"
161
  redis-cli info | grep 'used_memory\|connected_clients\|total_connections_received'
162
+
 
 
 
 
163
  # 检查 Qdrant
164
  echo "Qdrant 状态:"
165
  if curl -s http://localhost:6333/metrics >/dev/null; then