Error Creating Index Admin.system.version:13 ERR: "Not authorized to create index on ADMIN.SYSTEM.V

Source: Internet
Author: User
Tags create index mongodb mongorestore
One: Problem description

Today, when doing a full-database recovery, error:

[root@ser6-52 mytest]# mongorestore-u superuser-p 123--authenticationdatabase admin/backup/mongodb/full_bak_201507 021651.bak/

Connected to:127.0.0.1

2015-07-02t17:45:45.297+0800 going into namespace [admin.system.version]

Restoring to Admin.system.version without dropping. Restored data would be inserted without raising errors; Check your server log

1 objects found

2015-07-02t17:45:45.298+0800 Creating index: {key: {_id:1}, Name: "_id_", ns: "Admin.system.version"}

Error Creating Index Admin.system.version:13 ERR: "Not authorized to create index on Admin.system.version"

Aborted (core dumped)
Two: Cause of error

The user lacks restore permissions

--I thought Root was the biggest privilege, and I didn't think it would be due to a lack of restore permissions. Oh, really.


Three: Solutions

Empowerment:

> Db.grantrolestouser ("Superuser", [{role: "Restore", DB: "admin"}]);

--Try to restore again:

[root@ser6-52 ~]# mongorestore-u superuser-p 123456--authenticationdatabase admin/backup/mongodb/full_bak_20150702 1651.bak/

Connected to:127.0.0.1

2015-07-03t09:30:20.275+0800 going into namespace [admin.system.version]

Restoring to Admin.system.version without dropping. Restored data would be inserted without raising errors; Check your server log

1 objects found

2015-07-03t09:30:20.276+0800 Creating index: {key: {_id:1}, Name: "_id_", ns: "Admin.system.version"}

2015-07-03t09:30:20.277+0800/backup/mongodb/full_bak_201507021651.bak/admin/system.users.bson

2015-07-03t09:30:20.277+0800 going into namespace [admin.system.users]

Restoring to Admin.system.users without dropping. Restored data would be inserted without raising errors; Check your server log

2 objects found

2015-07-03t09:30:20.282+0800 Creating index: {key: {_id:1}, Name: "_id_", ns: "Admin.system.users"}

2015-07-03t09:30:20.282+0800 Creating index: {unique:true, key: {user:1, db:1}, Name: "User_1_db_1", NS: "Admin.sys Tem.users "}

2015-07-03t09:30:20.285+0800/backup/mongodb/full_bak_201507021651.bak/mytest/d.bson

2015-07-03t09:30:20.285+0800 going into namespace [MYTEST.D]

Objects found

2015-07-03t09:30:20.286+0800 Creating index: {key: {_id:1}, Name: "_id_", ns: "MYTEST.D"}

2015-07-03t09:30:20.288+0800/backup/mongodb/full_bak_201507021651.bak/mytest/c.bson

2015-07-03t09:30:20.288+0800 going into namespace [mytest.c]

Restoring to mytest.c without dropping. Restored data would be inserted without raising errors; Check your server log

Objects found

2015-07-03t09:30:20.295+0800 Creating index: {key: {_id:1}, Name: "_id_", ns: "Mytest.c"}

--Role Permissions Please refer to: MongoDB User rights operation


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.