feat: Support Password Access for ElasticSearch (#1072)
### What problem does this PR solve? Using password authentication to access ElasticSearch is essential, especially in a production environment. This PR will enable password access support. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
4454ba7a1e
commit
195498daaa
@ -15,6 +15,8 @@ minio:
|
|||||||
host: 'minio:9000'
|
host: 'minio:9000'
|
||||||
es:
|
es:
|
||||||
hosts: 'http://es01:9200'
|
hosts: 'http://es01:9200'
|
||||||
|
username: 'elastic'
|
||||||
|
password: 'infini_rag_flow'
|
||||||
redis:
|
redis:
|
||||||
db: 1
|
db: 1
|
||||||
password: 'infini_rag_flow'
|
password: 'infini_rag_flow'
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
# Version of Elastic products
|
# Version of Elastic products
|
||||||
STACK_VERSION=8.11.3
|
STACK_VERSION=8.11.3
|
||||||
|
|
||||||
# Set the cluster name
|
|
||||||
CLUSTER_NAME=rag_flow
|
|
||||||
|
|
||||||
# Port to expose Elasticsearch HTTP API to the host
|
# Port to expose Elasticsearch HTTP API to the host
|
||||||
ES_PORT=1200
|
ES_PORT=1200
|
||||||
|
|
||||||
|
# Set the Elasticsearch password
|
||||||
|
ELASTIC_PASSWORD=infini_rag_flow
|
||||||
|
|
||||||
# Port to expose Kibana to the host
|
# Port to expose Kibana to the host
|
||||||
KIBANA_PORT=6601
|
KIBANA_PORT=6601
|
||||||
|
|
||||||
|
|||||||
@ -8,12 +8,12 @@ services:
|
|||||||
- ${ES_PORT}:9200
|
- ${ES_PORT}:9200
|
||||||
environment:
|
environment:
|
||||||
- node.name=es01
|
- node.name=es01
|
||||||
- cluster.name=${CLUSTER_NAME}
|
|
||||||
- cluster.initial_master_nodes=es01
|
|
||||||
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
|
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
|
||||||
- bootstrap.memory_lock=false
|
- bootstrap.memory_lock=false
|
||||||
- xpack.security.enabled=false
|
- discovery.type=single-node
|
||||||
- cluster.max_shards_per_node=4096
|
- xpack.security.enabled=true
|
||||||
|
- xpack.security.http.ssl.enabled=false
|
||||||
|
- xpack.security.transport.ssl.enabled=false
|
||||||
- TZ=${TIMEZONE}
|
- TZ=${TIMEZONE}
|
||||||
mem_limit: ${MEM_LIMIT}
|
mem_limit: ${MEM_LIMIT}
|
||||||
ulimits:
|
ulimits:
|
||||||
|
|||||||
@ -15,6 +15,8 @@ minio:
|
|||||||
host: 'minio:9000'
|
host: 'minio:9000'
|
||||||
es:
|
es:
|
||||||
hosts: 'http://es01:9200'
|
hosts: 'http://es01:9200'
|
||||||
|
username: 'elastic'
|
||||||
|
password: 'infini_rag_flow'
|
||||||
redis:
|
redis:
|
||||||
db: 1
|
db: 1
|
||||||
password: 'infini_rag_flow'
|
password: 'infini_rag_flow'
|
||||||
|
|||||||
@ -28,6 +28,8 @@ class ESConnection:
|
|||||||
try:
|
try:
|
||||||
self.es = Elasticsearch(
|
self.es = Elasticsearch(
|
||||||
settings.ES["hosts"].split(","),
|
settings.ES["hosts"].split(","),
|
||||||
|
basic_auth=(settings.ES["username"], settings.ES["password"]) if "username" in settings.ES and "password" in settings.ES else None,
|
||||||
|
verify_certs=False,
|
||||||
timeout=600
|
timeout=600
|
||||||
)
|
)
|
||||||
if self.es:
|
if self.es:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user