Distributed Data Management
Distributed data management leverages distributed virtual bus to manage application data and user data distributed on different devices. Under such management, user data is no longer bound to a single physical device, service logic is decoupled from storage, and applications are running across devices.
Distributed data management is ported from the upstream OpenHarmony 3.2 Release. It consists of the following components.
Component | openEuler Software Package | Description |
---|---|---|
Distributed Data Service (DDS) | distributeddatamgr_datamgr_service | Provides the capability to store data in the databases of different devices. |
KV store | distributeddatamgr_kv_store | Manages key-value pairs for device applications. |
Relational database | distributeddatamgr_relational_store | Manages data using a relational model. |
Distributed Data Object | distributeddatamgr_data_object | An object-oriented in-memory data management framework featuring multi-device synchronization. |
For more information about distributed data management, see section Data Management in the OpenHarmony document .
Installation
Distributed data management has been integrated in openEuler 22.03 LTS SP3 by default. You can directly install it.
dnf install distributeddatamgr_kv_store distributeddatamgr_relational_store distributeddatamgr_datamgr_service distributeddatamgr_data_object
Service Startup
You can run the start_services.sh script to start the DDS.
/system/bin/start_services.sh datamgr
You can run the
ps
command to check whether the distributed data management service is started.ps -ef | grep distributeddata
Usage
Create the /data directory required for running the demo. OpenHarmony applications require specific directories for running. Therefore, you need to create the directories in openEuler.
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
Write the client programs for the three databases (kv_store, data_object, and relational_store) to use the distributed data function.
For details about how to write the client programs, see the demo source code of each database in Repository. The source code is stored in the demo directory in the directory corresponding to each database, for example, kv_store/demo. You can use the build.sh script in the demo directory for compilation.
Notice
It is recommended that the database path db specified by the demo be the same as the path of the sample demo. Otherwise, the path may not exist or the permission may be insufficient.
Stop the distributed management service datamgr_service.
./stop_services.sh all #Stop all services. ./stop_services.sh datamgr #Stop only the datamgr service.
FAQs
When a service is started, the error message "Binder Driver died " is displayed.
Cause: Binder is not enabled in the system. You can check whether the /dev/binder file exists. If the file does not exist, Binder is not enabled.
Solution: Enable the binder function. For details, see communication_ipc Repository Description.
The softbus_server service fails to be started, and the error message "GetNetworkIfIp ifName:eth0 fail" is displayed.
Cause: Run the
ip a
command to view the name of the NIC in the current system and check whether the wired NIC eth0 exists. The softbus_server service obtains information such as the IP address through the wired NIC eth0. If eth0 does not exist, softbus_server cannot be started.Solution 1: Change the NIC name to eth0.
Solution 2: Modify the softbus_server source code and change the name of the dependent wired NIC to that of the NIC in the current system.