mongodb에서 윈도우즈 서비스를 등록할 수 없습니다

5919 단어 데이터베이스

mongodb에서 윈도우즈 서비스를 등록할 수 없습니다


1:MongoDB를 설치한 후 윈도우즈 서비스로 등록합니다.
두 가지 방법이 있습니다.
  • 명령행 매개변수 통과
  • mongod --dbpath "D:\1\12\mongodb\data\db" --logpath "D:\1\12\mongodb\data\log\mongodb.log"  --install --serviceName "MongoDB"
    
  • 구성 파일을 통해
  • mongod –install -f “D:\Program Files\MongoDB\mongo.conf” mongo.conf의 내용은 다음과 같습니다.
    dbpath = "D:\Program Files\MongoDB\Data\DB"
    logpath = "D:\Program Files\MongoDB\Data\Log\mongodb.log"
    logappend = true
    directoryperdb = true
    serviceName = "MongoDBService"
    serviceDisplayName = "MongoDBService"
    port = 27017

    명령이 실행된 후 명령줄은 아무런 출력도 없이 끝났지만, 서비스를 시작할 때 넷 start Mongo 서비스를 호출해도 반응이 없습니다. 가입 서비스가 실패했습니다.
    로그 파일 보기 mongodb.log, 다음 레코드 발견:
    59:46.730+0800 I CONTROL  [main] ***** SERVER RESTARTED *****
    59:47.130+0800 I CONTROL  [main] Trying to install Windows service 'MongoDBService'
    59:47.130+0800 I CONTROL  [main] Error connecting to the Service Control Manager:  。 (5)

    해결 방법:
    cmd를 찾았습니다.exe, 관리자로 오른쪽 단추를 눌러서 실행한 다음 상기 등록 서비스의 명령을 실행합니다.
    2: 또 오류 보고:
    logPath requires an absolute file path with Windows services
    
    dbPath requires an absolute file path with Windows services

    해결 방법:
    구성 파일의 따옴표 제거
    3: 설치 성공:
    등록 서비스의 명령을 다시 실행한 후 로그를 보면 다음과 같은 기록이 발견되어 설치가 성공했음을 알 수 있습니다.
    23:53.286+0800 I CONTROL  [main] Trying to install Windows service '"MongoDBService"'
    23:53.286+0800 I CONTROL  [main] Service '"MongoDBService"' ("MongoDBService1") installed with command line '"D:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --config D:\program\MongoDB\mongo.conf --service'
    23:53.286+0800 I CONTROL  [main] Service can be started from the command line with 'net start "MongoDBService"'

    4: 서비스 시작:
    D:\>net start MongoDBService
    The MongoDBService1 service is starting...
    The MongoDBService1 service was started successfully.

    5: 서비스 삭제 중지
    net stop MongoDBService
    mongod.exe --remove --serviceName "MongoDB"

    구성 파일에\"\"번호가 없으면 경로 문제,\"\"서비스 이름에 문제가 발생할 수 있으므로 주의하십시오.올바른 구성 파일:
    dbpath = D:\Program Files\MongoDB\Data\DB
    logpath = D:\Program Files\MongoDB\Data\Log\mongodb.log
    logappend = true
    directoryperdb = true
    serviceName = MongoDBService
    serviceDisplayName = MongoDBService
    port = 27017

    "서비스 이름에""이(가) 있는 경우 등록 삭제를 시작할 때 필요한 경우""이(가) 필요합니다."

    좋은 웹페이지 즐겨찾기