Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
4aa272fc97
!14 将master分支内容同步至24.03分支
From: @yukaii 
Reviewed-by: @heppen 
Signed-off-by: @heppen
2024-04-30 01:47:14 +00:00
openeuler-ci-bot
ab368fcfa8
!13 适配master
From: @heppen 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2024-03-08 09:55:05 +00:00
heppen
716cc7f573 buildrequires on openssl-devel change to compat-openssl11-devel 2024-03-07 14:42:37 +08:00
heppen
a2dd72db46 add readme 2024-03-01 12:03:46 +08:00
openeuler-ci-bot
490a0dbbe4
!12 添加README说明
From: @heppen 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2023-12-22 02:41:52 +00:00
heppen
dbc26b6f75 add readme 2023-12-21 16:53:33 +08:00
openeuler-ci-bot
bb6a909df6
!11 fix bug: spec中重复build requires,缺少requires
From: @heppen 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2023-12-13 08:03:55 +00:00
heppen
72da67ece5 bug fix: add Requires in spec file 2023-12-13 15:28:00 +08:00
openeuler-ci-bot
c82d88a21a
!9 请求将distributeddatamgr_datamgr_service合入sp3分支
From: @zxstty 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2023-12-11 08:21:57 +00:00
zxstty
6eb1c15ffb change by zjq 2023-12-06 16:43:55 +08:00
4 changed files with 153 additions and 2572 deletions

File diff suppressed because it is too large Load Diff

135
README.md
View File

@ -1,37 +1,122 @@
# distributeddatamgr_datamgr_service
# 分布式数据管理
#### 介绍
Distributed Data Service (DDS) provides the capability to store data in the databases of different devices. DDS isolates data based on a triplet of the account, app, and database. DDS synchronizes data between trusted devices to provide users with consistent data access experience on different devices.
分布式数据管理基于分布式软总线,实现了应用程序数据和用户数据的分布式管理。用户数据不再与单一物理设备绑定,业务逻辑与数据存储分离,应用跨设备运行时数据无缝衔接。
#### 软件架构
软件架构说明
分布式数据管理由上游 `OpenHarmony 3.2 Release` 版本移植而来,目前包含四个组件:
| 组件 | 对应openEuler软件包 | 功能介绍 |
| --- | --- | --- |
| 分布式数据服务Distributed Data Service | distributeddatamgr_datamgr_service | 提供不同设备间数据库数据分布式的能力 |
| 键值对数据库KV store | distributeddatamgr_kv_store | 为设备应用提供键值对数据管理能力 |
| 关系型数据库Relational store | distributeddatamgr_relational_store | 基于关系模型来管理数据的数据库 |
| 分布式数据对象部件Data object | distributeddatamgr_data_object | 具备多设备数据同步的面向对象的内存数据管理框架 |
更多分布式数据管理介绍,可参考[上游 OpenHarmony 文档 “数据管理” 相关章节](https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/database/data-mgmt-overview.md/)。
## 安装
分布式数据管理相关组件目前在 openEuler-22.03-LTS-SP2 update 版本 和openEuler-22.03-LTS-SP3 版本发布,两个版本下的安装略有不同。
### openEuler-22.03-LTS-SP2 版本
分布式数据管理首次发布于 openEuler-22.03-LTS-SP2 update版本如果是使用 openEuler-22.03-LTS-SP2 版本,需要配置 update 版本的 repo步骤如下
1. 在 `/etc/yum.repos.d` 目录下新增 update repo 配置文件 sp2_update.repo其内容填写如下
```config
[sp2_update]
name=sp2_update
baseurl=https://repo.openeuler.org/openEuler-22.03-LTS-SP2/EPOL/update/main/$basearch/
enabled=1
```
1. 更新 repo 源。(需要保证当前网络可以访问 https://repo.openeuler.org
```shell
dnf makecache
```
1. 下载安装分布式管理的四个软件包及其依赖软件包
```shell
dnf install distributeddatamgr_kv_store distributeddatamgr_relational_store distributeddatamgr_datamgr_service distributeddatamgr_data_object
```
1. 如果是 openEuler-22.03-LTS-SP2 版本,需要配置 SA 服务拉起需要的 profile 文件,可以从 [](https://gitee.com/heppen/distributed-files-for-test/tree/master/profile) 下载。
```shell
mkdir -p /system/profile
wget https://gitee.com/heppen/distributed-files-for-test/raw/master/profile/device_manager.xml -P /system/profile/
wget https://gitee.com/heppen/distributed-files-for-test/raw/master/profile/distributeddata.xml -P /system/profile/
wget https://gitee.com/heppen/distributed-files-for-test/raw/master/profile/distributedfiledaemon.xml -P /system/profile/
wget https://gitee.com/heppen/distributed-files-for-test/raw/master/profile/huks_service.xml -P /system/profile/
wget https://gitee.com/heppen/distributed-files-for-test/raw/master/profile/softbus_server.xml -P /system/profile/
```
1. 下载 [服务启停脚本](https://gitee.com/heppen/distributed-data-files/blob/master/scripts/)
```shell
wget https://gitee.com/heppen/distributed-data-files/raw/master/scripts/start_services.sh -P /system/bin/
wget https://gitee.com/heppen/distributed-data-files/raw/master/scripts/stop_services.sh -P /system/bin/
chmod +x /system/bin/*.sh
```
### openEuler-22.03-LTS-SP3 版本
分布式数据管理在 openEuler-22.03-LTS-SP3 版本已经默认集成,直接安装即可:
```shell
dnf install distributeddatamgr_kv_store distributeddatamgr_relational_store distributeddatamgr_datamgr_service distributeddatamgr_data_object
```
## 启动服务
1. 分布式数据服务可以通过 start_services.sh 脚本来启动
```shell
/system/bin/start_services.sh datamgr
```
1. 可以通过 ps 命令查看分布式数据管理服务是否拉起
```shell
ps -ef | grep distributeddata
```
## 使用分布式数据功能
1. 新建demo运行需要的/data目录。因为OpenHarmony下app运行有指定的目录需要在openEuler下先新增
```shell
mkdir -p /data/app/el0/0/database/com.example.distributed.rdb/rdb
mkdir -p /data/app/el1/0/database/distributeddata/kvdb
mkdir -p /data/service/el1/public/database/distributeddata/meta
mkdir -p /data/service/el1/public/database/distributeddata/kvdb
mkdir -p /data/service/el1/public/database/distributeddata/meta/backup
```
1. 编写三个数据库kv_store/data_object/relational_store的客户端程序使用分布式数据功能。
客户端程序编写可参考[仓库](https://gitee.com/heppen/distributed-data-files)每个数据库的 demo 源代码demo 在这个仓库每个数据库同名目录下的 demo目录下`kv_store/demo`,可使用对应目录下的 build.sh 脚本进行编译。
**注意demo 指定的数据 db 路径等,请最好保持和所给示例 demo 的路径一致,否则可能会存在路径不存在或者权限不足问题。**
#### 安装教程
1. 暂停分布式管理服务 datamgr_service
```shell
./stop_services.sh all # 停止所有服务
./stop_services.sh datamgr # 停止datamgr一个服务
```
1. xxxx
2. xxxx
3. xxxx
## 常见问题
#### 使用说明
* 启动各个服务日志一直在报错 `Binder Driver died`
1. xxxx
2. xxxx
3. xxxx
原因:说明系统未开启 binder可以查看 `/dev/binder` 文件是否存在,如果不存在则说明未开启 binder。
#### 参与贡献
解决方法启动binder功能参考[communication_ipc仓库说明](https://gitee.com/src-openeuler/communication_ipc/blob/46d83ed1462e521ce356aec48ef980dbf84cff80/README.md)开启binder功能。
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
* `softbus_server` 服务未成功起来,报错 `GetNetworkIfIp ifName:eth0 fail`
原因:使用命令 `ip a` 查看当前系统的网卡名称,查看是否有 `eth0` 有线网卡名。 因为 `softbus_server` 是通过 `eth0` 这个有线网卡名来获取 ip 等信息,如果没有 `eth0` 网卡则无法启动 `softbus_server`
#### 特技
解决方法一:修改网卡名称为 `eth0`
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
解决方法二:修改 `softbus_server` 源码,将依赖的有线网卡名称改成当前系统的网卡名。
## 参考
1. [分布式文件系统概述](https://docs.openeuler.org/zh/docs/22.03_LTS_SP2/docs/Distributed/%E5%88%86%E5%B8%83%E5%BC%8F%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84.html)

View File

@ -1,24 +1,33 @@
%define debug_package %{nil}
%global oh_version OpenHarmony-v3.2-Release
%global datamgr_service_dir %{_builddir}/foundation/distributeddatamgr/
%global distributeddata_dir %{_builddir}/foundation/distributeddatamgr/
%global build_opt /opt/distributed-middleware-build
Name: distributeddatamgr_datamgr_service
Version: 1.0.0
Release: 2
Release: 3
Summary: Distributed data manager that provides the capability to store data in the databases of different devices
License: Apache-2.0
Url: https://gitee.com/openharmony/distributeddatamgr_datamgr_service
Source0: https://gitee.com/openharmony/distributeddatamgr_datamgr_service/repository/archive/OpenHarmony-v3.2-Release.tar.gz#/distributeddatamgr_datamgr_service-OpenHarmony-v3.2-Release.tar.gz
Patch0: 0001-remove-useless-dependency.patch
Patch1: 0002-add-huks-component.patch
Patch2: 0003-establish-kvstore-dependence-on-boundscheck.patch
Source1: https://gitee.com/openharmony/distributeddatamgr_datamgr_service/repository/archive/%{oh_version}.tar.gz#/distributeddatamgr_datamgr_service-%{oh_version}.tar.gz
Patch1: 0001-remove-useless-dependency.patch
Patch2: 0002-establish-kvstore-dependence-on-boundscheck.patch
BuildRequires: libatomic libicu-devel libxml2-devel openssl-devel
BuildRequires: distributed-build distributed-build_lite hilog distributed-utils
BuildRequires: distributeddatamgr_relational_store distributeddatamgr_kv_store
BuildRequires: libboundscheck, zlib, zlib-devel, jsoncpp, jsoncpp-devel, compat-openssl11-devel
BuildRequires: distributed-build, distributed-beget, hilog, commonlibrary_c_utils
BuildRequires: communication_ipc, communication_dsoftbus
BuildRequires: systemabilitymgr_safwk, systemabilitymgr_samgr
BuildRequires: security_dataclassification, security_device_auth, security_huks
BuildRequires: distributedhardware_device_manager
BuildRequires: distributeddatamgr_kv_store, distributeddatamgr_relational_store
Requires: hilog distributed-utils distributeddatamgr_kv_store distributeddatamgr_relational_store
Requires: libboundscheck, zlib, zlib-devel, jsoncpp, jsoncpp-devel, compat-openssl11-devel
Requires: distributed-beget, hilog, commonlibrary_c_utils
Requires: communication_ipc, communication_dsoftbus
Requires: systemabilitymgr_safwk, systemabilitymgr_samgr
Requires: security_dataclassification, security_device_auth, security_huks
Requires: distributedhardware_device_manager
Requires: distributeddatamgr_kv_store, distributeddatamgr_relational_store
%description
Distributed Data Service (DDS) provides the ability to distribute database data between different devices.
@ -28,30 +37,29 @@ providing users with a consistent data access experience on various terminal dev
%prep
rm -rf %{_builddir}/*
cd %{_builddir}
cp -rp %{build_opt} %{_builddir}/build
cp -rf %{build_opt} %{_builddir}/build
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
mv build/openeuler/vendor %{_builddir}/
cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}
%setup -q -T -a 0 -c -n %{datamgr_service_dir}
mv %{datamgr_service_dir}%{name}-%{oh_version} %{datamgr_service_dir}datamgr_service
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}/
%patch0 -p1 -d %{datamgr_service_dir}datamgr_service
%patch1 -p1 -d %{_builddir}/base/security
%patch2 -p1 -d %{datamgr_service_dir}datamgr_service
%setup -q -D -T -a 1 -c -n %{distributeddata_dir}
if [ -d "%{distributeddata_dir}/datamgr_service" ]; then
rm -rf %{distributeddata_dir}/datamgr_service
fi
mv %{distributeddata_dir}/%{name}-%{oh_version} %{distributeddata_dir}/datamgr_service
%patch -P1 -p1 -d %{distributeddata_dir}/datamgr_service
%patch -P2 -p1 -d %{distributeddata_dir}/datamgr_service
%build
cd %{_builddir}
rm -rf %{_builddir}/out
%ifarch x86_64
./build.sh --product-name openeuler --target-cpu x86_64
%{_builddir}/build.sh --product-name openeuler --target-cpu x86_64
%endif
%ifarch aarch64
./build.sh --product-name openeuler --target-cpu arm64
%{_builddir}/build.sh --product-name openeuler --target-cpu arm64
%endif
%install
@ -62,22 +70,27 @@ install -d -m 0755 %{buildroot}/system/lib64
install -d -m 0755 %{buildroot}/system/etc/distributeddata/conf
%ifarch aarch64
module_out_path="out/openeuler/linux_clang_arm64/distributeddatamgr/datamgr_service"
%define lib_out_path out/openeuler/linux_clang_arm64/distributeddatamgr/datamgr_service
%endif
%ifarch x86_64
module_out_path="out/openeuler/linux_clang_x86_64/distributeddatamgr/datamgr_service"
%define lib_out_path out/openeuler/linux_clang_x86_64/distributeddatamgr/datamgr_service
%endif
install -m 0755 %{_builddir}/${module_out_path}/*.so %{buildroot}%{_libdir}
install -m 0755 %{_builddir}/${module_out_path}/*.so %{buildroot}/system/lib64
install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/profile/distributeddata.xml %{buildroot}/system/profile
install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/etc/distributeddata/conf/* %{buildroot}/system/etc/distributeddata/conf/
install -m 0755 %{_builddir}/%{lib_out_path}/*.so %{buildroot}%{_libdir}
install -m 0755 %{_builddir}/%{lib_out_path}/*.so %{buildroot}/system/lib64
%define config_path out/openeuler/packages/phone/system
install -m 0755 %{_builddir}/%{config_path}/profile/distributeddata.xml %{buildroot}/system/profile
install -m 0755 %{_builddir}/%{config_path}/etc/distributeddata/conf/* %{buildroot}/system/etc/distributeddata/conf/
%files
%{_libdir}/*.so
/system/*
%changelog
* Tue Nov 21 2023 Peng He <hepeng68@huawei.com> - 1.0.0-3
- Update build requires and requires.
* Thu Aug 03 2023 Peng He <hepeng68@huawei.com> - 1.0.0-2
- Add requires and rectify the contents of the RPM package.