在Ubuntu中安装mongodb
2015-10-28 10:50
633 查看
#下载密钥文件 sudoapt-keyadv--keyserverhkp://keyserver.ubuntu.com:80--recv7F0CEB10gpg:下载密钥‘7F0CEB10’,从hkp服务器keyserver.ubuntu.com gpg:密钥7F0CEB10:公钥“RichardKreuter”已导入 gpg:没有找到任何绝对信任的密钥 gpg:合计被处理的数量:1 gpg:已导入:1(RSA:1)
#在source.list中增加MongoDB源的配置 sudovim/etc/apt/source.list/............... debhttp://downloads-distro.mongodb.org/repo/ubuntu-upstartdist10gen #更新软件源 sudoapt-getupdate
#安装MongoDB服务器端 sudoapt-getinstallmongodb-10gen
Ubuntu下安装pip的方法安装pip的方法:
InstallpipandvirtualenvforUbuntu10.10Maverickandnewer$sudoapt-getinstallpython-pippython-devbuild-essential
$sudopipinstall--upgradepip
$sudopipinstall--upgradevirtualenv
ForolderversionsofUbuntuInstallEasyInstall
$sudoapt-getinstallpython-setuptoolspython-devbuild-essential
Installpip
$sudoeasy_installpip
Installvirtualenv
$sudopipinstall--upgradevirtualenv解压后,首先进入解压后目录安装easyinstall:sudopythonez_setup.py然后安装mongo-connector:sudopythonsetup.pyinstall
下一步,我们将启动MongoConnector。为了下载和安装MongoConnector,你可以使用pip:
pipinstallmongo-connector
为了示例的正常进行,我们假设你已经安装好了Elasticsearch,且运行于端口为9200的本地机器。你可以使用下面的命令从MongoDB复制到Elasticsearch。
mongo-connector-mlocalhost:27017-tlocalhost:9200-dmongo_connector/doc_managers/elastic_doc_manager.py
当然,如果只想在post标题和内容中进行文本搜索,我们可以使用Elasticsearch的字段选项来限制字段。通过这个方法,我们能最小化所复制的数据量:
mongo-connector-mlocalhost:27017-tlocalhost:9200--fieldstitle,text-dmongo_connector/doc_managers/elastic_doc_manager.py
就像你看到reddit2mongo将Redditpost以STDOUT输出,你同样可以看到从MongoConnector输出的日志——所有文档都在同时发送给了ES。
相关文章推荐
- Linux下快速安装MongoDB
- MongoDB Ubuntu安装 APP 支付宝微信支付
- 使用mongoosejs链接Mongodb
- mongodb 3.0.x 添加用户名和密码设置权限
- mongodb服务安装,搭建副本集及原理概述
- MongoDB当前操作db.currentOp()示例
- MongoDB当前操作db.currentOp()示例
- MongoDB安装及运用
- Spring与MongoDB整合
- Mongodb基本操作之.net
- PHP操作MongoDB数据库
- MongoDB 学习笔记四 C#调用MongoDB
- Mac OX上安装MongoDb
- MongoDBManager
- Mongodb3.0配置文件
- MongoDB介绍
- mongodb分配集群 shard key
- MongoDB小技巧-用ObjectID查询某一时间范围内的数据
- MongoDB(四)之副本集
- mongodb 3.0.2与wiredTiger存储引擎安装测试