欢迎投稿

今日深度:

【MongoDB】The Access control of mongodb,mongodbaccess

【MongoDB】The Access control of mongodb,mongodbaccess


In this blog we mainly talk about the access control including limitation of ip, setting listen port and usage of username and password. In the official document, mongodb server start without the argument , so once the connection was created, the remote client could do everything. But in the productive environment it’s advisable to take security into consideration and to enhance the security protection. For the sake of lowing the potential risk, the above measures could be taken to deal with these problems. 
First, Binding IP address to access MongoDB. 
Mongodb could put restriction on the ip address thought argument ‘bind_ip’ when being started. For example, now we only limit ip address[192.168.55.165] to access the server.





Secondly, use the certain port 




Thirdly,  add user and password





公司准备使用mongodb数据库,我查了很多资料都是一些对于mongodb使用上的问题,有mongodb的费用问题

mongodb 是免费的
 

帮帮忙,我刚接触mongodb,怎使用java对mongodb数据库进行多条件查询,先了

package maven.demo.test;

import java.util.ArrayList;
import java.util.List;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.QueryOperators;

public class MongoDB {
private static void print(String str){
System.out.println(str);
}
public static void main(String[] args) {
try {
//创建连接
Mongo m=new Mongo("127.0.0.1", 27017);
//得到数据库
DB db=m.getDB("test");
//得到所有数据库
//List<String> colls=m.getDatabaseNames();
//for(String str:colls){
//System.out.println(str);
//}

////得到所有的集合(表)
//for(String collection:db.getCollectionNames()){
//System.out.println(collection);
//}

//删除一个数据库
//m.dropDatabase("sun");

//得到sun表
DBCollection coll=db.getCollection("things");

//查看一个表的索引
//for(DBObject index:coll.getIndexInfo()){
//System.out.println(index);
//}

//DBObject myDoc=coll.findOne();
//System.out.println(myDoc);

//添加
//BasicDBObject doc=new BasicDBObject();
//doc.put("name", "sunshan");
//doc.put("sex", "男");
//doc.put("age", 22);
//coll.insert(doc);......余下全文>>
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/4293.html NewsArticle 【MongoDB】The Access control of mongodb,mongodbaccess In this blog we mainly talk about the access control including limitation of ip, setting listen port and usage of username and password. In the official document, mongodb server sta...
评论暂时关闭