电影推荐系统-环境搭建(二)
先来安装MongoDB-业务数据库
1)先解压压缩包
[root@tjx1 tars]# tar -zxvf mongodb-linux-x86_64-rhel62-3.4.3.tgz -C /usr/local/
2)进入解压后的安装包
[root@tjx1 local]# cd mongodb-linux-x86_64-rhel62-3.4.3/
3)在里面创建目录data/db、data/logs分别用来存放数据库数据和日志
[root@tjx1 mongodb-linux-x86_64-rhel62-3.4.3]# mkdir data
[root@tjx1 mongodb-linux-x86_64-rhel62-3.4.3]# cd data/
[root@tjx1 data]# mkdir db
[root@tjx1 data]# cd db
[root@tjx1 db]# pwd
/usr/local/mongodb-linux-x86_64-rhel62-3.4.3/data/db
[root@tjx1 db]# cd ..
[root@tjx1 data]# mkdir logs
[root@tjx1 data]# ll
total 0
drwxr-xr-x 2 root root 6 Sep 1 08:14 db
drwxr-xr-x 2 root root 6 Sep 1 08:17 logs
4)然后再创键mongodb.log文件于新建的logs目录下
[root@tjx1 data]# cd logs/
[root@tjx1 logs]# touch mongodb.log
5)接下来在data目录下创建并编辑一个配置文件--mongodb.conf
[root@tjx1 data]# touch mongodb.conf
[root@tjx1 data]# vi mongodb.conf
配置内容:
dbpath=/usr/local/mongodb-linux-x86_64-rhel62-3.4.3/data/db
logpath=/usr/local/mongodb-linux-x86_64-rhel62-3.4.3/data/logs/mongodb.log
设置后台是否运行
fork=true
日志输出的方式
logappend=true
6)启动MongoDB
[root@tjx1 mongodb-linux-x86_64-rhel62-3.4.3]# ./bin/mongod -config ./data/mongodb.conf
7)启动好了之后,可用一个工具连接它
工具安装好了之后是这样的:
双击打开:
连接上了就证明MongoDB安装并启动好了。
以后会在里面新建一些库、表也都会在里面显示出来。
工作中如果用到MongoDB集群,安装过程会交给运维人员来完成。
这里我就只安装一个节点的。