2017-02-22 5 views
3

새로 배포 된 응용 프로그램의 자격 증명은 MongoDB에서 "인증 실패"로 거부됩니다. MongoDB Ops Manager는 이미 "AdjustUsers"에 몇 시간 동안 붙어 있습니다. 포털에 얻은 MongoDB의 서비스 키를 사용하여 http://localhost:8080 및 로그인에"인증 실패"및 Ops Manager가 "AdjustUsers"에 걸린 상태에서 MongoDB Enterprise에 연결하지 못함

cf service-connector 8080 opsmanager.service.consul:8080 

브라우저 열기 :


에 의해 검증

"ops_manager_url": "http://opsmanager.service.consul:8080", 
"ops_manager_user": "xxx", 
"ops_manager_password": "xxx", 

최근 20기가바이트 주위에 복원했습니다 of mongorestore :

cf service-connector 27020 xxx-0.service.consul:33602 
mongorestore --gzip --port 27020 --username xxx --password xxx --db rs_xxx /backup/mongodump/ > mongorestore.log 2>&1 & 

기타 기존의 앱에는 문제가 없습니다.

답변

2
: ("1 w") : 나는 블루 - 그린 배포를 사용하여 배포 만이 응용 프로그램은 연결에 실패

cf push $APP-new 
cf map-route $APP-new $DOMAIN --hostname $APP 
cf unmap-route $APP $DOMAIN --hostname $APP || true 
cf unmap-route $APP-new $DOMAIN --hostname $APP-new 
cf delete -f $APP 
cf rename  $APP-new $APP 

을 내 응용 프로그램에서 나는 WriteConcern를 지정하지 않는, 그래서 그것은 단지 주요 가정

마다 cf bind-service 또는 cf unbind-service으로 Servicebroker (Cloud Foundry 구성 요소)은 새로운 임의 생성 생성 인증 정보를 생성합니다 (cf env $APP 참조). MongoEnterprise 서비스를 통해 Service Broker는 Ops Manager API에 연결하고 새로운 User를 mongod 복제본에 배포합니다.

옵스 관리자가 사용자 ( createUser)를 배포

enter image description here

그는 쓰기를 인정하는 적어도 하나 개의 보조 요구를 의미 WriteConcern "대부분"를 사용합니다.

COMMAND [conn53768] command rs_$DBNAME.$cmd command: createUser { createUser: "$USERNAME", pwd: "xxx", digestPassword: false, roles: [ { role: "readWrite", db: "rs_$DBNAME" } ], writeConcern: { w: "majority" } } keyUpdates:0 writeConflicts:0 numYields:0 reslen:138 locks:{ Global: { acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { W: 2 } }, Collection: { acquireCount: { w: 2 } } } protocol:op_query 9811ms 

이 문제가 발생하기 전에 몇 시간을 수행 한 mongorestore, 탓으로 createUser 명령으로 인해 전경 바쁜 건물 인덱스 있었다 세컨더리의 승인의 부족으로 시간 초과 된 가능성이있다 및 배경. 색인 빌드 (기본 mongorestore 옵션)는 기본에서 먼저 완료되고 완료되면 보조에서 진행됩니다. 이는 createUser 동안 보조 직원의 지연 시간을 설명합니다.

인덱스 빌드는 인덱스 및 데이터 크기에 따라 매우 오랜 시간이 걸릴 수 있습니다. 우리는 인덱스 구축에 관한 많은 고객 불만이 너무 오래 걸린다 고 들었습니다.

다음은 색인 빌드의 로그입니다. Ops Manager에서 고객은 모든 복제 세트 구성원에서 약간 지연된 스트리밍 mongodb.log (opsmanager.service.consul)을 볼 수 있습니다. WriteConcern와 모든 :

... 
2017-02-15T10:40:06.199+0000 I INDEX [repl writer worker 10] build index done. scanned 1108917 total records. 672 secs 
2017-02-15T10:50:08.553+0000 I INDEX [repl writer worker 4] build index done. scanned 1108917 total records. 602 secs 
2017-02-15T11:01:13.888+0000 I INDEX [repl writer worker 7] build index done. scanned 1108917 total records. 665 secs 
... 
2017-02-15T15:01:37.405+0000 I INDEX [repl index builder 176] build index done. scanned 1109531 total records. 659 secs 
2017-02-15T15:01:37.406+0000 I INDEX [repl index builder 170] build index done. scanned 1109531 total records. 659 secs 
2017-02-15T15:16:20.139+0000 I INDEX [repl index builder 170] build index done. scanned 1109699 total records. 882 secs 

Automation Agent에서 오류가 있습니다

[2017/02/15 13:33:36.297] [.error] [cm/mongoctl/authctl.go:updateUser26Style:697] [101] <rs_$DB_NAME> [13:33:36.297] Error updating 2.6-style user = AuthUser([email protected]_$DB_NAME,roles=AuthRoles(1:{"Rolename":"readWrite","Db":"rs_$DB_NAME"}),interned=true,identity=2) in db = rs_$DB_NAME : <rs_$DB_NAME> [13:33:36.297] Timed out (timeout=-1ns) trying to runCommandWithTimeout(dbName=rs_$DB_NAME, cmd=[{"Name":"updateUser","Value":"$USER"},{"Name":"pwd","Value":"$PASSWORD"},{"Name":"digestPassword","Value":false},{"Name":"roles","Value":[{"db":"rs_$DB_NAME","role":"readWrite"}]}]) 
[2017/02/15 13:33:36.297] [.error] [cm/mongoctl/authctl.go:UpsertUser:516] [101] <rs_$DB_NAME> [13:33:36.297] Error upserting 2.6-style user = AuthUser([email protected]_$DB_NAME,roles=AuthRoles(1:{"Rolename":"readWrite","Db":"rs_$DB_NAME"}),interned=true,identity=2) : <rs_$DB_NAME> [13:33:36.297] Error updating 2.6-style user = AuthUser([email protected]_$DB_NAME,roles=AuthRoles(1:{"Rolename":"readWrite","Db":"rs_$DB_NAME"}),interned=true,identity=2) in db = rs_$DB_NAME : <rs_$DB_NAME> [13:33:36.297] Timed out (timeout=-1ns) trying to runCommandWithTimeout(dbName=rs_$DB_NAME, cmd=[{"Name":"updateUser","Value":"$USER"},{"Name":"pwd","Value":"$PASSWORD"},{"Name":"digestPassword","Value":false},{"Name":"roles","Value":[{"db":"rs_$DB_NAME","role":"readWrite"}]}]) 
[2017/02/15 13:33:36.297] [.error] [cm/action/adjustusers.go:adjustUsers:52] [101] <rs_$DB_NAME> [13:33:36.297] Error upserting user = AuthUser([email protected]_$DB_NAME,roles=AuthRoles(1:{"Rolename":"readWrite","Db":"rs_$DB_NAME"}),interned=true,identity=2). Trying to proceed though. : <rs_$DB_NAME> [13:33:36.297] Error upserting 2.6-style user = AuthUser([email protected]_$DB_NAME,roles=AuthRoles(1:{"Rolename":"readWrite","Db":"rs_$DB_NAME"}),interned=true,identity=2) : <rs_$DB_NAME> [13:33:36.297] Error updating 2.6-style user = AuthUser([email protected]_$DB_NAME,roles=AuthRoles(1:{"Rolename":"readWrite","Db":"rs_$DB_NAME"}),interned=true,identity=2) in db = rs_$DB_NAME : <rs_$DB_NAME> [13:33:36.297] Timed out (timeout=-1ns) trying to runCommandWithTimeout(dbName=rs_$DB_NAME, cmd=[{"Name":"updateUser","Value":"$USER"},{"Name":"pwd","Value":"$PASSWORD"},{"Name":"digestPassword","Value":false},{"Name":"roles","Value":[{"db":"rs_$DB_NAME","role":"readWrite"}]}]) 
[2017/02/15 13:33:36.381] [.error] [cm/executor/executor.go:ExecutePlan:184] <rs_$DB_NAME> [13:33:36.381] Postcondition failed for step AdjustUsers because 
[The value of 'currentState.UsersRight' = false, but it should be true]. Outcome=3 

요약 (Manager가 관리 VM에 Autoamtion 에이전트와 HTTP를 통해 말하는 본부, 자동화 에이전트는 기본 프로토콜 mongod로 말) 기본은 정상적으로 작동하지만 WriteConcern 대다수 시간이 지나면 인덱스 빌드를 차단합니다.

cf push $APP-new 
# only old app active 

# test new app 
curl --fail --silent --output /dev/null https://$APP-new.$DOMAIN/status 

cf map-route $APP-new $DOMAIN --hostname $APP 
# both apps active 
cf apps 
cf routes 

cf unmap-route $APP $DOMAIN --hostname $APP || true 
# only new app active 

cf unmap-route $APP-new $DOMAIN --hostname $APP-new 
cf delete -f $APP 
cf rename  $APP-new $APP 

cf apps 

이 예는 있다고 가정합니다

1

한 가지 방법은 이전 (응용 프로그램 수준에서 건강 검진을) 해제 매핑하기 전에 새로 배치 된 응용 프로그램을 테스트하고 삭제하여 바인딩 DB를 성공하지 못한 것을 알 수 있습니다 앱 이름은 호스트 이름과 동일합니다.