欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Apache Usergrid
小 (→链接) |
小 (→用户) |
||
(未显示1个用户的84个中间版本) | |||
第1行: | 第1行: | ||
Apache Usergrid 是一个面向web和移动应用的多租户 [[Mobile Backend as a service|Backend-as-a-Service]] 堆栈,基于 RESTful APIs,使用 [[Apache Cassandra]] 做后端存储。 | Apache Usergrid 是一个面向web和移动应用的多租户 [[Mobile Backend as a service|Backend-as-a-Service]] 堆栈,基于 RESTful APIs,使用 [[Apache Cassandra]] 做后端存储。 | ||
+ | |||
+ | ==简介== | ||
+ | Apache Usergrid — the BaaS not made for Hipsters | ||
+ | |||
+ | ==新闻== | ||
+ | *[https://cloud.google.com/blog/products/apigee/we-are-sunsetting-apigee-api-baas Google is sunsetting the Apache Usergrid based API BaaS service] (May 18, 2018) | ||
+ | |||
+ | ==版本== | ||
+ | *[https://blogs.apache.org/usergrid/entry/apache_usergrid_2_1_now 2.1] | ||
+ | new "[https://github.com/apache/usergrid/tree/usergrid-2.1.0/stack/corepersistence core persistence]" engine in Usegrid 2.1 has been under development for two years now. Internally, this new engine provides a set of new modules for Entity Collections, [[Graph database]], Maps, Query-Index, Queues and Caching. The core persistence design favors simple and composable operations that can be made asynchronous via [https://github.com/ReactiveX/RxJava RxJava], uses Multi-Version Concurrency Control (MVCC) to avoid use of locks and the Query-Index module relies on [[Elasticsearch]]. | ||
+ | *2.0 | ||
+ | *1.0 | ||
+ | |||
+ | ==应用对象== | ||
+ | Usergrid提供了一组核心应用程序对象,主要实现了对用户的管理以及对交互性的增强、通过自由的数据存储系统存储数据、检索以及返回任何类型的内容和对象集合等。Usergrid也提供了对日志数据的支持,这使得实时事件分析和关键指标的跟踪成为可能,这块可考虑由[[KairosDB]]提供服务。 | ||
+ | |||
+ | 应用对象(Data Entity Types)包括: | ||
+ | * 用户(user) | ||
+ | * 用户组(group) | ||
+ | * 角色(role) | ||
+ | * 应用(application) | ||
+ | * 行为(activity) | ||
+ | * 设备(device) | ||
+ | * 资源(asset) | ||
+ | * 目录(folder) | ||
+ | * 事件(event) | ||
+ | * 通知(notifier) | ||
+ | * 通告(notification) | ||
+ | * 收到(receipt) | ||
+ | |||
+ | 每个对象都被保存在其各自的集合中(/users,/groups……)。Usergrid也允许创建用户想要的任何类型的动态(自定义的)实体。动态实体会被自动保存在以实体类型复数为名称的集合中。 | ||
+ | |||
+ | 所提及的消息(message)概念是以notifier、notification、receipt数据实体类型体现。 | ||
+ | |||
+ | [https://usergrid.apache.org/docs/rest-endpoints/api-docs.html#models Usergrid 默认实体数据模型] | ||
+ | |||
+ | ==Activity Streams== | ||
+ | |||
+ | Activity是一个代表Activity Stream actions的实体类型。 | ||
+ | |||
+ | [[Activity Streams]] 用来描述一个社交网络中的个体的一系列活动。比如 Facebook 的 News Feed(新鲜事)就是一条 Activity Streams 消息。目前 Activity Streams 已经成了 OpenSocial 的标准数据格式并被广泛地支持。Activity Streams entry 元素总是包含三个主元素,它们分别是:actor,即执行动作的人,例如:DoctorWang;verb,即执行的动作类型,例如:admit;object,即动作所针对的对象,例如用户 John。 | ||
+ | |||
+ | [http://activitystrea.ms/specs/json/1.0/ JSON Activity Streams 1.0] | ||
+ | |||
+ | ==授权== | ||
+ | Usergrid的API实现了[[OAuth]] 2.0的授权模型,所有的请求都需要带有有效的访问令牌。 | ||
+ | |||
+ | ==消息== | ||
+ | Usergrid提供了一个消息队列服务,该服务为保证高扩展性的同时向应用中分发消息所设计。此外为了使消息队列服务具备一定的灵活性,还将会增加客户通知、社交收件箱、内容源、评论功能以及其他一些常见的消息队列操作。该框架支持使用[[HTML5/websockets|Websocket]]来进行实时处理。 | ||
+ | |||
+ | *[https://github.com/apache/usergrid/blob/usergrid-2.1.0/stack/core/src/main/java/org/apache/usergrid/mq package org.apache.usergrid.mq;] | ||
+ | |||
+ | 集成[[RabbitMQ]] | ||
+ | |||
+ | 集成[[Apache Kafka]] | ||
+ | |||
+ | ==Spring== | ||
+ | [[Spring]]承担了[https://github.com/apache/usergrid/search?p=4&q=spring&unscoped_q=spring Usergrid核心框架]的重任。 | ||
+ | |||
+ | ==REST API== | ||
+ | *[https://github.com/apache/usergrid/tree/master/stack/rest Usergrid REST API Web App] | ||
+ | *[https://issues.apache.org/jira/browse/USERGRID-812 REST API v2] | ||
+ | *Usergrid REST API 构建在 [[Jersey]] 之上。 | ||
+ | *[http://code.huihoo.com/huihoo/mbaas/issues/17 Jersey @ Usergrid] | ||
+ | *[[Jackson]] 处理 [[JSON]] 数据。 | ||
+ | |||
+ | ==服务层== | ||
+ | *[https://github.com/apache/usergrid/tree/master/stack/services Usergrid Services Layer] | ||
+ | *用户和组权限建立在[[Apache Shiro]]之上。 | ||
+ | |||
+ | ==SDK== | ||
+ | ===Dart & Flutter=== | ||
+ | |||
+ | ===iOS=== | ||
+ | *[https://github.com/apache/usergrid/tree/master/sdks/swift Swift SDK] | ||
+ | *[https://github.com/apache/usergrid/tree/master/sdks/ios Objective-C SDK] | ||
+ | |||
+ | ===Android=== | ||
+ | [https://github.com/apache/usergrid-android Android SDK] | ||
+ | |||
+ | ===H5/JS=== | ||
+ | [https://github.com/apache/usergrid-javascript JavaScript SDK] | ||
+ | |||
+ | ===Node.js=== | ||
+ | [https://github.com/apache/usergrid-nodejs usergrid-nodejs] | ||
+ | |||
+ | ==Go== | ||
+ | * 基于REST API,支持 [[Go]] 语言,提供 Go SDK。 | ||
+ | * 集成 Go 提供的高并发处理基础设施。 | ||
+ | |||
+ | ==Scala== | ||
+ | 集成 [[Scala]] | ||
+ | |||
+ | ==Clojure== | ||
+ | 集成 [[Clojure]] | ||
+ | |||
+ | ==安装== | ||
+ | *[https://usergrid.apache.org/docs/installation/deployment-guide.html Usergrid 2.1.0 Deployment Guide] | ||
+ | *[https://usergrid.apache.org/docs/installation/ug1-deploy-to-tomcat.html Usergrid 1.x Deployment Guide] | ||
+ | *[http://code.huihoo.com/huihoo/mbaas/issues/3 Usergrid安装部署] | ||
==指南== | ==指南== | ||
+ | * [https://github.com/apache/usergrid/releases/tag/usergrid-2.1.0 Usergrid 2.x] | ||
+ | * [https://github.com/apache/usergrid/releases/tag/usergrid-1.0.2 Usergrid 1.x] | ||
+ | 确保已正确安装 [[Apache Cassandra]],[https://github.com/apache/usergrid/releases 下载usergrid包并解压] 或[http://mirror.bit.edu.cn/apache/usergrid/usergrid-2/v2.1.0/ 直接下载二进制压缩包],[https://usergrid.apache.org/docs/installation/deployment-guide.html 参考Usergrid 2.1.0安装部署]。此外,[https://usergrid.apache.org/docs/installation/ug1-deploy-to-tomcat.html Usergrid 1.x安装部署]。 | ||
+ | cd sdks/java | ||
+ | mvn clean install | ||
+ | cd stack | ||
+ | mvn clean package -DskipTests=true | ||
+ | //cd launcher; java -jar target/usergrid-launcher-*.jar // Usergrid 1.x 版本 | ||
+ | cp stack/rest/target/ROOT.war 到 tomcat7/webapps 然后完成下面配置并重启。 | ||
+ | curl http://localhost:8080/status | ||
+ | curl -X POST \ | ||
+ | -d 'organization=myfirstorg&username=myadmin&name=Admin&[email protected]&password=password' \ | ||
+ | http://localhost:8080/management/organizations | ||
+ | curl 'http://localhost:8080/management/token?grant_type=password&username=myadmin&password=password' | ||
+ | 你也能以 tomcat webapp 的方式运行, | ||
+ | 移除 tomcat/webapps/ROOT 下的内容,将 usergird/rest/ROOT.war 拷贝到这 | ||
+ | |||
+ | cd tomcat/lib 创建 ____usergrid-custom.properties____ | ||
+ | usergrid.sysadmin.login.allowed=true | ||
+ | usergrid.sysadmin.login.name=superuser | ||
+ | usergrid.sysadmin.login.password=pw123 | ||
+ | |||
+ | |||
+ | usergrid.management.mailer=Myself<[email protected]> | ||
+ | |||
+ | usergrid.test-account.admin-user.password=test | ||
+ | 数据库设置 | ||
+ | http://localhost:8080/system/database/setup | ||
+ | curl -X PUT http://localhost:8080/system/database/setup -u superuser:test | ||
+ | curl -X PUT http://localhost:8080/system/database/bootstrap -u superuser:test | ||
+ | curl -X GET http://localhost:8080/system/superuser/setup -u superuser:test | ||
+ | 管理员设置 | ||
+ | http://localhost:8080/system/superuser/setup | ||
+ | 控制台, 配置文件 usergrid-custom.properties | ||
+ | http://localhost:8080/usergrid-portal | ||
+ | 单独运行一个轻量server | ||
+ | cd portal | ||
+ | ./build.sh dev | ||
+ | http://localhost:3000/index-debug.html | ||
+ | http://localhost:3000/ | ||
+ | |||
+ | ==部署方式== | ||
+ | *[https://github.com/apache/usergrid/tree/master/deployment/aws AWS Cluster] | ||
+ | *Apache HTTPD, [https://usergrid.apache.org/docs/installation/deployment-guide.html?highlight=tomcat Tomcat] | ||
+ | *[[Nginx]] + [[Jetty]] | ||
+ | |||
+ | ==Elasticsearch== | ||
+ | [[Elasticsearch]] 提供[https://usergrid.apache.org/docs/installation/deployment-guide.html?highlight=elasticsearch 查询服务] | ||
+ | |||
+ | ==Cassandra== | ||
+ | *[[Apache Cassandra]] 提供[https://usergrid.apache.org/docs/search.html?q=cassandra&check_keywords=yes&area=default 存储服务] | ||
+ | *使用[https://github.com/netflix/astyanax Netflix Astyanax] Cassandra Java Client | ||
+ | |||
+ | ==集群== | ||
+ | *[[Hazelcast]] | ||
+ | |||
+ | ==性能== | ||
+ | *[https://blogs.apache.org/usergrid/entry/usergrid_10k_part1 Scaling Usergrid to over 10,000 requests/second - Part 1] 10,268 Requests Per Second with 35 c3.xlarge Usergrid servers and 9 c3.4xlarge Cassandra nodes. | ||
+ | *引入[[Akka]]高并发框架。 | ||
+ | |||
+ | ==Akka== | ||
+ | [https://github.com/apache/usergrid/tree/release-2.1.1 Apache Usergrid 2.1.1]在[https://github.com/apache/usergrid/tree/9b12299cc46a0143bd9a646ee7031c61669b1718/stack/corepersistence corepersistence持久化框架]中引入[[Akka]] actorsystem | ||
+ | |||
+ | ==RPC== | ||
+ | *Cassandra RPC 9160端口 | ||
+ | *[http://wiki.huihoo.com/images/3/3a/Cmcm-go-02.png 参考猎豹移动的Go架构] | ||
+ | *[[grpc]]和[https://github.com/grpc/grpc-go go语言实现] | ||
+ | *[https://github.com/grpc/grpc-java grpc-java] | ||
==开发者== | ==开发者== | ||
+ | *Usergrid Creator, [http://anuff.com Ed Anuff], [http://docs.huihoo.com/apache/usergrid/Open-Source-Mobile-Backend-on-Cassandra.pdf Open Source Mobile Backend on Cassandra] [https://github.com/edanuff @GitHub] | ||
+ | *[[Apache Usergrid/developer|开发者]] | ||
==用户== | ==用户== | ||
第9行: | 第179行: | ||
*[http://easemob.com/ 环信] | *[http://easemob.com/ 环信] | ||
*[http://www.globo.com/ Globo.com] | *[http://www.globo.com/ Globo.com] | ||
− | *[https://developers.apigee.com Apigee] | + | *[https://developers.apigee.com Apigee] |
==文档== | ==文档== | ||
第16行: | 第186行: | ||
*[http://docs.huihoo.com/apache/usergrid/Apache-Usergrid-Internals.pdf Apache Usergrid Internals] | *[http://docs.huihoo.com/apache/usergrid/Apache-Usergrid-Internals.pdf Apache Usergrid Internals] | ||
*[http://docs.huihoo.com/apache/usergrid/Open-Source-Mobile-Backend-on-Cassandra.pdf Open Source Mobile Backend on Cassandra] | *[http://docs.huihoo.com/apache/usergrid/Open-Source-Mobile-Backend-on-Cassandra.pdf Open Source Mobile Backend on Cassandra] | ||
+ | *[http://docs.huihoo.com/apache/cassandra/Cassandra-Data-Modeling-Best-Practices-at-eBay.pdf Cassandra Data Modeling Best Practices at eBay] [http://docs.huihoo.com/apache/cassandra/Cassandra-at-eBay.pdf Cassandra at eBay] [http://docs.huihoo.com/apache/cassandra/planetcassandra/Cassandra-at-eBay-Scale.pdf Cassandra Scale at eBay] | ||
==图集== | ==图集== | ||
<gallery> | <gallery> | ||
− | image:mbaas-architecture.png| | + | image:mbaas-architecture.png|容器架构 |
− | image:mbaas-multi-tenancy-on-cassandra.png| | + | image:mbaas-multi-tenancy-on-cassandra.png|Cassandra |
+ | image:usergrid-launcher.png|Launcher | ||
+ | image:apache-usergrid-service.png|Service架构 | ||
+ | image:Apache-Usergrid-iOS-App.png|iOS App | ||
+ | image:apache-usergrid-core.png|Core架构 | ||
+ | image:apache-usergrid-portal.jpg|控制台 | ||
+ | image:apache-usergrid-groups.png|用户组 | ||
+ | image:apache-usergrid-cassandra.png|Keyspace | ||
</gallery> | </gallery> | ||
==链接== | ==链接== | ||
*[https://usergrid.apache.org Apache Usergrid官网] | *[https://usergrid.apache.org Apache Usergrid官网] | ||
+ | *[https://github.com/apache/usergrid Apache Usergrid @ GitHub] | ||
*[http://docs.huihoo.com/apache/usergrid Apache Usergrid文档] | *[http://docs.huihoo.com/apache/usergrid Apache Usergrid文档] | ||
[[category:mobile]] | [[category:mobile]] | ||
+ | [[category:REST]] | ||
[[category:apache]] | [[category:apache]] | ||
+ | [[category:spring]] |
2024年9月30日 (一) 23:44的最后版本
Apache Usergrid 是一个面向web和移动应用的多租户 Backend-as-a-Service 堆栈,基于 RESTful APIs,使用 Apache Cassandra 做后端存储。
目录 |
[编辑] 简介
Apache Usergrid — the BaaS not made for Hipsters
[编辑] 新闻
[编辑] 版本
new "core persistence" engine in Usegrid 2.1 has been under development for two years now. Internally, this new engine provides a set of new modules for Entity Collections, Graph database, Maps, Query-Index, Queues and Caching. The core persistence design favors simple and composable operations that can be made asynchronous via RxJava, uses Multi-Version Concurrency Control (MVCC) to avoid use of locks and the Query-Index module relies on Elasticsearch.
- 2.0
- 1.0
[编辑] 应用对象
Usergrid提供了一组核心应用程序对象,主要实现了对用户的管理以及对交互性的增强、通过自由的数据存储系统存储数据、检索以及返回任何类型的内容和对象集合等。Usergrid也提供了对日志数据的支持,这使得实时事件分析和关键指标的跟踪成为可能,这块可考虑由KairosDB提供服务。
应用对象(Data Entity Types)包括:
- 用户(user)
- 用户组(group)
- 角色(role)
- 应用(application)
- 行为(activity)
- 设备(device)
- 资源(asset)
- 目录(folder)
- 事件(event)
- 通知(notifier)
- 通告(notification)
- 收到(receipt)
每个对象都被保存在其各自的集合中(/users,/groups……)。Usergrid也允许创建用户想要的任何类型的动态(自定义的)实体。动态实体会被自动保存在以实体类型复数为名称的集合中。
所提及的消息(message)概念是以notifier、notification、receipt数据实体类型体现。
[编辑] Activity Streams
Activity是一个代表Activity Stream actions的实体类型。
Activity Streams 用来描述一个社交网络中的个体的一系列活动。比如 Facebook 的 News Feed(新鲜事)就是一条 Activity Streams 消息。目前 Activity Streams 已经成了 OpenSocial 的标准数据格式并被广泛地支持。Activity Streams entry 元素总是包含三个主元素,它们分别是:actor,即执行动作的人,例如:DoctorWang;verb,即执行的动作类型,例如:admit;object,即动作所针对的对象,例如用户 John。
[编辑] 授权
Usergrid的API实现了OAuth 2.0的授权模型,所有的请求都需要带有有效的访问令牌。
[编辑] 消息
Usergrid提供了一个消息队列服务,该服务为保证高扩展性的同时向应用中分发消息所设计。此外为了使消息队列服务具备一定的灵活性,还将会增加客户通知、社交收件箱、内容源、评论功能以及其他一些常见的消息队列操作。该框架支持使用Websocket来进行实时处理。
集成RabbitMQ
[编辑] Spring
Spring承担了Usergrid核心框架的重任。
[编辑] REST API
- Usergrid REST API Web App
- REST API v2
- Usergrid REST API 构建在 Jersey 之上。
- Jersey @ Usergrid
- Jackson 处理 JSON 数据。
[编辑] 服务层
- Usergrid Services Layer
- 用户和组权限建立在Apache Shiro之上。
[编辑] SDK
[编辑] Dart & Flutter
[编辑] iOS
[编辑] Android
[编辑] H5/JS
[编辑] Node.js
[编辑] Go
- 基于REST API,支持 Go 语言,提供 Go SDK。
- 集成 Go 提供的高并发处理基础设施。
[编辑] Scala
集成 Scala
[编辑] Clojure
集成 Clojure
[编辑] 安装
[编辑] 指南
确保已正确安装 Apache Cassandra,下载usergrid包并解压 或直接下载二进制压缩包,参考Usergrid 2.1.0安装部署。此外,Usergrid 1.x安装部署。
cd sdks/java mvn clean install cd stack mvn clean package -DskipTests=true //cd launcher; java -jar target/usergrid-launcher-*.jar // Usergrid 1.x 版本 cp stack/rest/target/ROOT.war 到 tomcat7/webapps 然后完成下面配置并重启。 curl http://localhost:8080/status curl -X POST \ -d 'organization=myfirstorg&username=myadmin&name=Admin&[email protected]&password=password' \ http://localhost:8080/management/organizations curl 'http://localhost:8080/management/token?grant_type=password&username=myadmin&password=password'
你也能以 tomcat webapp 的方式运行, 移除 tomcat/webapps/ROOT 下的内容,将 usergird/rest/ROOT.war 拷贝到这
cd tomcat/lib 创建 ____usergrid-custom.properties____
usergrid.sysadmin.login.allowed=true usergrid.sysadmin.login.name=superuser usergrid.sysadmin.login.password=pw123 [email protected] [email protected] usergrid.management.mailer=Myself<[email protected]> [email protected] usergrid.test-account.admin-user.password=test
数据库设置
http://localhost:8080/system/database/setup curl -X PUT http://localhost:8080/system/database/setup -u superuser:test curl -X PUT http://localhost:8080/system/database/bootstrap -u superuser:test curl -X GET http://localhost:8080/system/superuser/setup -u superuser:test
管理员设置
http://localhost:8080/system/superuser/setup
控制台, 配置文件 usergrid-custom.properties
http://localhost:8080/usergrid-portal
单独运行一个轻量server
cd portal ./build.sh dev http://localhost:3000/index-debug.html http://localhost:3000/
[编辑] 部署方式
- AWS Cluster
- Apache HTTPD, Tomcat
- Nginx + Jetty
[编辑] Elasticsearch
[编辑] Cassandra
- Apache Cassandra 提供存储服务
- 使用Netflix Astyanax Cassandra Java Client
[编辑] 集群
[编辑] 性能
- Scaling Usergrid to over 10,000 requests/second - Part 1 10,268 Requests Per Second with 35 c3.xlarge Usergrid servers and 9 c3.4xlarge Cassandra nodes.
- 引入Akka高并发框架。
[编辑] Akka
Apache Usergrid 2.1.1在corepersistence持久化框架中引入Akka actorsystem
[编辑] RPC
- Cassandra RPC 9160端口
- 参考猎豹移动的Go架构
- grpc和go语言实现
- grpc-java
[编辑] 开发者
- Usergrid Creator, Ed Anuff, Open Source Mobile Backend on Cassandra @GitHub
- 开发者
[编辑] 用户
[编辑] 文档
- Building Your Own BaaS With Apache Usergrid & Docker: Lessons Learned At Scale
- How to Contribute to Apache Usergrid
- Apache Usergrid Internals
- Open Source Mobile Backend on Cassandra
- Cassandra Data Modeling Best Practices at eBay Cassandra at eBay Cassandra Scale at eBay