Author: admin

  • git fatal: index file smaller than expected

    Error message from git:

    git fatal: index file smaller than expected

    Cause: Index files are corrupted.

    Solution: Remove and rebuild the index:

    rm .git/index
    git add .
    git reset HEAD

  • How to sudo without typing password

    Add this line in /etc/sudoers
    for a specific user:

    username ALL=NOPASSWD: ALL

    or for all sudoer users:
    %sudo ALL=NOPASSWD: ALL

  • Exception PDOException with message SQLSTATE[HY000] Name too long for LOGINREC field (severity 2)

    Error: When connecting to MS SQL using freetds 0.91 and php>5.3:

    Exception ‘PDOException’ with message ‘SQLSTATE[HY000] Name too long for LOGINREC field (severity 2)’

    Cause:

    Any string exceeds 30 characters in connection info like username, password, client host name will cause this error.

    Solution:

    Check client hostname in /etc/sysconfig/network, reduce it to less than 30 characters

    Check username and password length in DB connection string, reduce it to less than 30 characters

  • Docker pull error: Invalid registry endpoint https on Centos 7.1

    Error: docker pull does not work on insecure connection by default

    Solution for Centos 7: Add –insecure-registry option

    1. Edit /lib/systemd/system/docker.service:

    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    After=network.target docker.socket
    Requires=docker.socket

    [Service]
    EnvironmentFile=-/etc/sysconfig/docker
    Type=notify
    ExecStart=/usr/bin/docker daemon $other_args -H fd://
    MountFlags=slave
    LimitNOFILE=1048576
    LimitNPROC=1048576
    LimitCORE=infinity

    [Install]
    WantedBy=multi-user.target

    2. Edit /etc/sysconfig/docker

    other_args=”–insecure-registry registry_ip:port

    3. Restart docker daemon:

    sudo systemctl daemon-reload
    sudo service docker restart

  • MongoDB Ops Manager java.lang.OutOfMemoryError: unable to create new native thread

    When starting MongoDB Ops Manager version 1.8.2.312, we have this error:

    Migrate MMS data
    Running migrations…[  OK  ]
    Start MMS server
    Instance 0 starting……….[  OK  ]
    Start Backup HTTP Server
    Instance 0 starting…….[FAILED]
    instance: 0  – msg: unable to create new native thread

    Solution: Increase the max number of process for user mongodb-mms:

    $ sudo vi /etc/security/limits.d/90-nproc.conf

    mongodb-mms     soft    nproc     unlimited

  • MongoDB error local.oplog.rs is not empty on the initiating member. cannot initiate

    Error when initiating replica set with some old data in local database:

    rs.initiate() 
    {
    "errmsg" : "local.oplog.rs is not empty on the initiating member. cannot initiate.",
    "ok" : 0
    }

    Solution:

    use local

    db.oplog.rs.drop()

     

     

  • MongoDB replSet error loading set config (BADCONFIG)

    Error when initiate replicaset in MongoDB:

    “errmsg” : “replSet error loading set config (BADCONFIG)”, “ok” : 0 }

    Solution:

    1. Stop mongod, delete all local.* files in DBPath, start mongod or delete database local directly in mongo shell:

    use local
    db.dropDatabase()

    2. Reconfigure replica set members:

    config = {_id: “repl1”, members:[

    {_id: 0, host: ‘192.168.2.1:27017′},

    {_id: 1, host: ‘192.168.2.2:27017’}]

    }

     

    rs.reconfig(config, {force: true})

  • MongoDB failed to start Assertion failure isOk() src/mongo/db/storage/extent.h 80

    MongoDB failed to start with this error in log file:

    2015-08-28T01:24:17.062+0000 [initandlisten] build info: Linux build5.nj1.10gen. cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
    2015-08-28T01:24:17.062+0000 [initandlisten] allocator: tcmalloc
    2015-08-28T01:24:17.062+0000 [initandlisten] options: { config: “/etc/mongod.conf”, net: { port: 27017 }, processManagement: { pidFilePath: “/var/run/mongodb/mongod.pid” }, security: { authorization: “disabled” }, storage: { dbPath: “/var/lib/mongo”, journal: { enabled: false } }, systemLog: { destination: “file”, logAppend: true, path: “/var/lib/mongo/mongod.log”, quiet: true } }
    2015-08-28T01:24:17.164+0000 [initandlisten] test Assertion failure isOk() src/mongo/db/storage/extent.h 80
    2015-08-28T01:24:17.170+0000 [initandlisten] test 0x1205431 0x11a7229 0x118b53e 0xf04360 0xf436a3 0x8b779f 0xaa2ca0 0xd8237f 0x8cd367 0x76c32d 0x76e247 0x76ee7b 0x76f4b5 0x76f759 0x7f96a8516d5d 0x766329
    mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x1205431]
    mongod(_ZN5mongo10logContextEPKc+0x159) [0x11a7229]
    mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x17e) [0x118b53e]
    mongod(_ZNK5mongo13ExtentManager9getExtentERKNS_7DiskLocEb+0x60) [0xf04360]
    mongod(_ZN5mongo12FlatIteratorC1EPKNS_10CollectionERKNS_7DiskLocERKNS_20CollectionScanParams9DirectionE+0xd3) [0xf436a3]
    mongod(_ZNK5mongo10Collection11getIteratorERKNS_7DiskLocEbRKNS_20CollectionScanParams9DirectionE+0x9f) [0x8b779f]
    mongod(_ZN5mongo14CollectionScan4workEPm+0x350) [0xaa2ca0]
    mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_7DiskLocE+0xef) [0xd8237f]
    mongod(_ZN5mongo8Database19clearTmpCollectionsEv+0x147) [0x8cd367]
    mongod() [0x76c32d]
    mongod(_ZN5mongo14_initAndListenEi+0x637) [0x76e247]
    mongod(_ZN5mongo13initAndListenEi+0x1b) [0x76ee7b]
    mongod() [0x76f4b5]
    mongod(main+0x9) [0x76f759]
    /lib64/libc.so.6(__libc_start_main+0xfd) [0x7f96a8516d5d]
    mongod() [0x766329]
    2015-08-28T01:24:17.172+0000 [initandlisten] exception in initAndListen: 0 assertion src/mongo/db/storage/extent.h:80, terminating

    Cause: Your DB files are corrupted. Use

    mongod –repair

    command to fix:

    mongod –repair

  • tsung: line 52: 2055 Killed $ERL $ERL_OPTS $ERL_RSH -noshell $PROTO_DIST $NAMETYPE $CONTROLLER -setcookie $COOKIE

    Tsung crashes with an ambiguous error message:

    tsung: line 52: 2055 Killed
    $ERL $ERL_OPTS $ERL_RSH -noshell $PROTO_DIST $NAMETYPE $CONTROLLER -setcookie $COOKIE \
    -s tsung_controller \
    $EXTRA_LOAD_PATHS \
    -pa $TSUNGPATH -pa $CONTROLLERPATH \
    -ssl session_cb $SSL_CACHE \
    -ssl session_lifetime $SSL_SESSION_LIFETIME \
    -sasl sasl_error_logger false \
    -tsung_controller web_gui $WEB_GUI \
    -tsung_controller smp_disable $SMP_DISABLE \
    -tsung_controller debug_level $DEBUG_LEVEL \
    -tsung_controller warm_time $WARM_TIME \
    -tsung_controller exclude_tag \”$EXCLUDE_TAG_LIST\” \
    -tsung_controller config_file \”$CONF_OPT_FILE\”
    -tsung_controller $LOG_OPT
    -tsung_controller $MON_FILE

    Cause: Likely because the machine runs out of memory
    Solution: Add more memory using swap