• MongoDB 日志中出现“UserNotFound: Could not find user ceilometer@ceilometer”,如何解决?


    MongoDB 日志中出现“UserNotFound: Could not find user ceilometer@ceilometer”


    问题描述

    MongoDB(版本 3.2.9) 服务启动后,Ceilometer-api服务连接 MongoDB 的时候,报认证失败,导致8777端口一直用不了。

    MongoDB 日志报错,具体如下:

    2019-11-04T14:28:46.130+0800 I CONTROL  [signalProcessingThread] dbexit:  rc: 0
    2019-11-04T14:28:53.758+0800 I CONTROL  [main] ***** SERVER RESTARTED *****
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] MongoDB starting : pid=2586 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] db version v3.2.9
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] allocator: tcmalloc
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] modules: none
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] build environment:
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten]     distmod: ubuntu1404
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten]     distarch: x86_64
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten]     target_arch: x86_64
    2019-11-04T14:28:53.765+0800 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", engine: "wiredTiger", journal: { enabled: true }, wiredTiger: { collectionConfig: { blockCompressor: "snappy" }, engineConfig: { directoryForIndexes: true, journalCompressor: "snappy" }, indexConfig: { prefixCompression: true } } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
    2019-11-04T14:28:53.783+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=13G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
    2019-11-04T14:28:58.241+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
    2019-11-04T14:28:58.241+0800 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
    2019-11-04T14:28:58.241+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
    2019-11-04T14:28:59.019+0800 I NETWORK  [initandlisten] connection accepted from 10.117.26.104:44085 #1 (1 connection now open)
    2019-11-04T14:28:59.272+0800 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59823 #2 (2 connections now open)
    2019-11-04T14:28:59.417+0800 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59824 #3 (3 connections now open)
    2019-11-04T14:28:59.418+0800 I ACCESS   [conn3] SCRAM-SHA-1 authentication failed for ceilometer on ceilometer from client 127.0.0.1 ; UserNotFound: Could not find user ceilometer@ceilometer
    2019-11-04T14:28:59.802+0800 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59825 #4 (4 connections now open)
    2019-11-04T14:29:09.420+0800 I ACCESS   [conn3] SCRAM-SHA-1 authentication failed for ceilometer on ceilometer from client 127.0.0.1 ; UserNotFound: Could not find user ceilometer@ceilometer
    2019-11-04T14:29:19.421+0800 I ACCESS   [conn3] SCRAM-SHA-1 authentication failed for ceilometer on ceilometer from client 127.0.0.1 ; UserNotFound: Could not find user ceilometer@ceilometer
    2019-11-04T14:29:29.423+0800 I ACCESS   [conn3] SCRAM-SHA-1 authentication failed for ceilometer on ceilometer from client 127.0.0.1 ; UserNotFound: Could not find user ceilometer@ceilometer

    问题原因

    从日志信息中可以看出,MongoDB 中缺少 ceilometer 数据库  ceilometer 账号

    问题解决

    需要在 MongoDB 的 ceilometer 数据库里创建 ceilometer 账号

    具体命令如下三条:

    mongo
    use ceilometer;
    db.createUser( { user: "ceilometer", pwd: "password",roles: [ "readWrite", "dbAdmin" ] } );

    额外补充

    1)3.X 以前版本的 MongoDB 使用 db.addUser 方法创建用户,使用如下命令:

     db.addUser({user: "ceilometer", pwd: "password", roles: [ "readWrite", "dbAdmin" ]});

    2)3.X 以后版本的 MongoDB 不再支持 db.addUser 方法创建用户,必须使用 db.createUser 方法创建用户,使用如下命令:

    db.createUser( { user: "ceilometer", pwd: "password",roles: [ "readWrite", "dbAdmin" ] } ); 
  • 相关阅读:
    把Linux安装到移动硬盘上
    关于thinkphp 开发的网站部署问题
    lamp 网站打不开,不显示也不报错,
    前端之css语法3
    前端之css笔记2
    前端之练习2
    前端之css笔记1
    前端之笔记1
    前端之练习1
    MySQL之练习题5
  • 原文地址:https://www.cnblogs.com/miracle-luna/p/11802758.html
Copyright © 2020-2023  润新知