本资源库包含rpc-server和web-server两个工程。rpc-server演示微服务的搭建。web-server演示web服务、数据库访问、数据库变更监听、微服务调用等。
-
启动mysql数据库,创建一个test数据库,然后执行web-server根目录下的db.sql文件
-
启动redis和zookeeper,它们都使用默认端口
-
分别运行web-server和rpc-server的org.test.Bootstrap类
如果只是想看演示,可以通过这个地址进行查看: http://120.55.49.121:9090/
使用下列url就可以访问rest接口
-
http://localhost:8081/rest/insertStudent?data={"name":"游夏","age":20}
-
用户登录:http://localhost:8081/login?username=admin&password=123456&code=9999
-
查看登录用户的信息:http://localhost:8081/rest/userInfo
例子中只有web-server工程有提供web服务,所以这里看的也是web-server工程的监控信息及文档信息
如果不想看哪个监控信息,只要将值设为0即可
http://localhost:8081/_sumk_acts?sign=helloworld&mode=http&pretty=1
支持模糊搜索,比如在参数里增加_name=app表示搜索接口名包含app的rest接口
http://localhost:8081/_sumk_acts?sign=helloworld&mode=beans.full