RestHeart手动环境搭建

需要安装如下软件:

Java8

MongoDB

RestHeart

1.安装Java和MongoDB检查

$ java-version

java version"1.8.0_66"Java(TM)SE Runtime Environment(build 1.8.0_66-b17)Java HotSpot(TM)64-Bit Server VM(build 25.66-b17, mixed mode)$ mongod--versiondb version v3.0.7

$ mongod--version

db version v3.6.4

2.安装RESTHeart

在GitHub上下载最新稳定版本,并解压缩,其中最重要的文件如下:

restheart.jar

etc/restheart.yml <- 配置文件例子

3.启动MongoDB

Linux:

mongod --fork --syslog --dbpath E:\data\test\db

Windows:

start /b mongod --dbpath E:\data\test\db --port 27017

4.启动RESTHeart

修改restheart.yml中的配置连接MongoDB

mongo-uri: mongodb://:@127.0.0.1/?authSource=admin

修改Shell环境变量:

$env:TMP="E:\temp"

cd .\restheart-3.2.2

java -server -jar restheart.jar etc/restheart.yml

5.验证安装结果

http://127.0.0.1:8080/browser admin/changeit

6.新建数据库

$ curl -u : -X PUT -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan

验证数据库创建成功

$ curl -u : -X GET -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan

7.新建集合

$ curl -v -u : -X PUT -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan/reports.files

$ curl -v -u admin:changeit -X PUT -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan/template.files

$ curl -v -u admin:changeit -X PUT -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan/signature.files

$ curl -v -u admin:changeit -X PUT -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan/attachment.files

验证集合创建成功

$ curl -u : -X GET -H "Content-Type: application/json" 127.0.0.1:8080/tianmenshan/reports.files

8.上传文件

$ curl -v -u : -X PUT -F "file=@123" 127.0.0.1:8080/tianmenshan/reports.files/test001

你可能感兴趣的:(RestHeart手动环境搭建)