Проблема с подключением Docker для Spring Boot с CouchbaseJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Проблема с подключением Docker для Spring Boot с Couchbase

Сообщение Anonymous »

Я хочу запустить свое приложение как Spring Boot с Couchbase локально и в Docker.
Ниже показан .env

Код: Выделить всё

COUCHBASE_USERNAME=Administrator
COUCHBASE_PASSWORD=123456
COUCHBASE_BUCKET=todo_list
COUCHBASE_HOST=127.0.0.1
Вот файл application.yml

Код: Выделить всё

spring:
application:
name: todowithcouchbase
config:
import: optional:file:.env[.properties]
couchbase:
connection-string: couchbase://${COUCHBASE_HOST:127.0.0.1}
username: ${COUCHBASE_USERNAME:Administrator}
password: ${COUCHBASE_PASSWORD:123456}
bucket: ${COUCHBASE_BUCKET:todo_list}
scopes:
user-scope: user-scope
task-scope: task-scope
invalid-token-scope : invalid-token-scope
log-scope: log-scope
collections:
user-collection: user-collection
task-collection: task-collection
invalid-token-collection: invalid-token-collection
log-collection : log-collection

data:
couchbase:
auto-index: true

server:
shutdown: graceful
port: 2323

# SWAGGER
springdoc:
api-docs:
enabled: true
show-actuator: true
Вот файл docker-compose.yml, показанный ниже

Код: Выделить всё

version: '3.9'
services:
couchbase:
image: couchbase:latest
container_name: couchbase
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
environment:
COUCHBASE_ADMINISTRATOR_USERNAME: ${COUCHBASE_USERNAME:-Administrator}
COUCHBASE_ADMINISTRATOR_PASSWORD: ${COUCHBASE_PASSWORD:-123456}
COUCHBASE_BUCKET: ${COUCHBASE_BUCKET:-todo_list}
COUCHBASE_AUTO_INDEX: true
volumes:
- ~/couchbase/node1:/opt/couchbase/var
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8091/ui/index.html" ]
interval: 30s
timeout: 10s
retries: 5
networks:
- my_network

todowithcouchbase:
build: .
container_name: todowithcouchbase
ports:
- 2323:2323
depends_on:
couchbase:
condition: service_healthy
environment:
COUCHBASE_BUCKET: ${COUCHBASE_BUCKET:-todo_list}
COUCHBASE_USER: ${COUCHBASE_USERNAME:-Administrator}
COUCHBASE_PASSWORD: ${COUCHBASE_PASSWORD:-123456}
COUCHBASE_HOST: couchbase
networks:
- my_network

networks:
my_network:
driver: bridge
У меня нет проблем запустить его локально. Когда я запустил docker-compose up -d, я получил эту ошибку, показанную ниже.

Код: Выделить всё

DNS SRV lookup failed (name not found). This is expected if the there is no DNS SRV record associated with the hostname in the connection string. Will now try to bootstrap directly from the given hostname.  To suppress this message, specify an IP address instead of a hostname (for example: 127.0.0.1 instead of localhost), specify more than one hostname, or set the `io.enableDnsSrv` client setting to false.

Connect attempt 1 failed because of AuthenticationFailureException: Authentication Failure - Potential causes: invalid credentials or if LDAP is enabled ensure PLAIN SASL mechanism is exclusively used on the PasswordAuthenticator (insecure) or TLS is used (recommended) {"bucket":"todo_list","circuitBreaker":"DISABLED","coreId":"0x1450b18f00000001","remote":"couchbase:11210","status":"UNKNOWN","type":"KV","xerror":{"ref":"b96586b3-65ae-4b33-9d5e-abb73869e6f9"}} {"bucket":"todo_list","circuitBreaker":"DISABLED","coreId":"0x1450b18f00000001","remote":"couchbase:11210","type":"KV"}

...

Connect attempt 25 failed because of AuthenticationFailureException: Authentication Failure - Potential causes: invalid credentials or if LDAP is enabled ensure PLAIN SASL mechanism is exclusively used on the PasswordAuthenticator (insecure) or TLS is used (recommended) {"bucket":"todo_list","circuitBreaker":"DISABLED","coreId":"0x1450b18f00000001","remote":"couchbase:11210","status":"UNKNOWN","type":"KV","xerror":{"ref":"b2f299fc-1e0b-497c-9d87-34be7eebbcc3"}} {"bucket":"todo_list","circuitBreaker":"DISABLED","coreId":"0x1450b18f00000001","remote":"couchbase:11210","type":"KV"}

ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'couchbaseBucket' defined in class path resource [com/example/todowithcouchbase/common/config/CouchbaseConfig.class]: Failed to instantiate [com.couchbase.client.java.Bucket]: Factory method 'couchbaseBucket' threw exception with message: CoreHttpRequest, Reason: TIMEOUT {"cancelled":true,"completed":true,"coreId":"0x1450b18f00000001","idempotent":true,"reason":"TIMEOUT","requestId":5,"requestType":"CoreHttpRequest","retried":156,"retryReasons":["AUTHENTICATION_ERROR"],"service":{"method":"GET","path":"/pools/default/buckets/","type":"mgmt"},"timeoutMs":75000,"timings":{"totalMicros":75006648}}
Как устранить проблему?

Подробнее здесь: https://stackoverflow.com/questions/792 ... -couchbase
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»