当前位置: 首页 > news >正文

Mongodb 3.6 数据恢复操作

一、安装MongoDB

忽略

二、创建账号和授权
  1. 在新的MongoDB上创建用户管理员。先切换到admin库,然后通过命令创建数据库管理员账号和密码。最后再验证账号密码是否创建成功!
use admin
db.createUser({user:"root",pwd:"123456Ab",roles:["userAdminAnyDatabase"]})
db.auth("root","123456Ab") #返回1表示登录成功

过程记录

C:\Users\administrator>mongo
MongoDB shell version v3.6.23
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("9c8640d6-7b58-4220-b2a5-286938940a38") }
MongoDB server version: 3.6.23
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, seehttp://docs.mongodb.org/
Questions? Try the support grouphttp://groups.google.com/group/mongodb-user
> use admin
switched to db admin
> db.createUser({user:"root",pwd:"123456Ab",roles:["userAdminAnyDatabase"]})
Successfully added user: { "user" : "root", "roles" : [ "userAdminAnyDatabase" ] }
> db.auth("root","123456Ab")
1
> exit
byeC:\Users\administrator>
  1. 在指定数据库上创建用户。

先切换到admin库,然后验证刚刚创建的管理root账号,再切换到新的ramsey数据库,通过命令创建账号和授权。

use admin
db.auth("root","123456Ab")
use ramsey
db.createUser({user:"ss",pwd:"secret",roles:[{role:"dbOwner", db:"ramsey"}]})

过程记录

C:\Users\administrator>mongo
MongoDB shell version v3.6.23
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("930e2c76-530e-4345-8840-4705075e2646") }
MongoDB server version: 3.6.23
>
> use admin
switched to db admin
> db.auth("root","123456Ab")
1
> use ramsey
switched to db ramsey
> db.createUser({user:"ss",pwd:"secret",roles:[{role:"dbOwner", db:"ramsey"}]})
Successfully added user: {"user" : "ss","roles" : [{"role" : "dbOwner","db" : "ramsey"}]
}
>
> exit
byeC:\Users\administrator>
三、恢复Mongodb数据

通过下面命令恢复数据

-- restore
mongorestore -h 127.0.0.1 --port 27017 -u ss -p secret -d ramsey C:\Mongodump\ramsey >> C:\Mongodump\ramsey\restore.log

过程记录

C:\Users\administrator>mongorestore -h 127.0.0.1 --port 27017 -u ss -p secret -d ramsey C:\Mongodump\ramsey >> C:\Mongodump\ramsey\restore.log
2024-07-16T15:17:24.818+0800    the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
2024-07-16T15:17:24.820+0800    building a list of collections to restore from C:\Mongodump\ramsey dir
2024-07-16T15:17:24.827+0800    don't know what to do with file "C:\Mongodump\ramsey\restore.log", skipping...
2024-07-16T15:17:24.833+0800    reading metadata for ramsey.sent_item from C:\Mongodump\ramsey\sent_item.metadata.json
2024-07-16T15:17:24.838+0800    reading metadata for ramsey.sent_item_archive from C:\Mongodump\ramsey\sent_item_archive.metadata.json
2024-07-16T15:17:24.839+0800    reading metadata for ramsey.failed_item from C:\Mongodump\ramsey\failed_item.metadata.json
2024-07-16T15:17:24.904+0800    reading metadata for ramsey.failed_item_archive from C:\Mongodump\ramsey\failed_item_archive.metadata.json
2024-07-16T15:17:24.915+0800    restoring ramsey.sent_item from C:\Mongodump\ramsey\sent_item.bson
2024-07-16T15:17:24.950+0800    restoring ramsey.failed_item from C:\Mongodump\ramsey\failed_item.bson
2024-07-16T15:17:24.964+0800    restoring ramsey.sent_item_archive from C:\Mongodump\ramsey\sent_item_archive.bson
2024-07-16T15:17:25.733+0800    restoring ramsey.failed_item_archive from C:\Mongodump\ramsey\failed_item_archive.bson
2024-07-16T15:17:28.184+0800    [........................]            ramsey.sent_item  47.7MB/6.46GB   (0.7%)
2024-07-16T15:17:28.186+0800    [######..................]          ramsey.failed_item   49.0MB/176MB  (27.7%)
2024-07-16T15:17:28.191+0800    [........................]    ramsey.sent_item_archive  42.6MB/1.30GB   (3.2%)
2024-07-16T15:17:28.192+0800    [###############.........]  ramsey.failed_item_archive  48.6MB/73.9MB  (65.8%)
2024-07-16T15:17:28.193+0800
2024-07-16T15:17:29.870+0800    [########################]  ramsey.failed_item_archive  73.9MB/73.9MB  (100.0%)
2024-07-16T15:17:29.879+0800    no indexes to restore
2024-07-16T15:17:29.886+0800    finished restoring ramsey.failed_item_archive (7526 documents)
2024-07-16T15:17:29.892+0800    reading metadata for ramsey.sending from C:\Mongodump\ramsey\sending.metadata.json
2024-07-16T15:17:29.934+0800    restoring ramsey.sending from C:\Mongodump\ramsey\sending.bson
2024-07-16T15:17:29.940+0800    no indexes to restore
2024-07-16T15:17:29.942+0800    finished restoring ramsey.sending (0 documents)
2024-07-16T15:17:30.808+0800    [........................]          ramsey.sent_item  108MB/6.46GB   (1.6%)
2024-07-16T15:17:30.820+0800    [##############..........]        ramsey.failed_item   107MB/176MB  (60.4%)
2024-07-16T15:17:30.847+0800    [#.......................]  ramsey.sent_item_archive  104MB/1.30GB   (7.9%)
2024-07-16T15:17:30.850+0800
2024-07-16T15:17:33.748+0800    [........................]          ramsey.sent_item  169MB/6.46GB   (2.6%)
2024-07-16T15:17:33.750+0800    [#####################...]        ramsey.failed_item   156MB/176MB  (88.3%)
2024-07-16T15:17:33.753+0800    [###.....................]  ramsey.sent_item_archive  179MB/1.30GB  (13.5%)
2024-07-16T15:17:33.758+0800
2024-07-16T15:17:34.348+0800    [########################]  ramsey.failed_item  176MB/176MB  (100.0%)
2024-07-16T15:17:34.348+0800    no indexes to restore
2024-07-16T15:17:34.355+0800    finished restoring ramsey.failed_item (18145 documents)
2024-07-16T15:17:36.757+0800    [........................]          ramsey.sent_item  263MB/6.46GB   (4.0%)
2024-07-16T15:17:36.757+0800    [#####...................]  ramsey.sent_item_archive  303MB/1.30GB  (22.9%)
2024-07-16T15:17:36.761+0800
2024-07-16T15:17:39.749+0800    [#.......................]          ramsey.sent_item  313MB/6.46GB   (4.7%)
2024-07-16T15:17:39.753+0800    [#######.................]  ramsey.sent_item_archive  431MB/1.30GB  (32.5%)
2024-07-16T15:17:39.758+0800
2024-07-16T15:17:42.748+0800    [#.......................]          ramsey.sent_item  361MB/6.46GB   (5.5%)
2024-07-16T15:17:42.748+0800    [#########...............]  ramsey.sent_item_archive  548MB/1.30GB  (41.3%)
2024-07-16T15:17:42.755+0800
2024-07-16T15:17:45.748+0800    [#.......................]          ramsey.sent_item  426MB/6.46GB   (6.4%)
2024-07-16T15:17:45.749+0800    [############............]  ramsey.sent_item_archive  675MB/1.30GB  (50.9%)
2024-07-16T15:17:45.755+0800
2024-07-16T15:17:48.748+0800    [#.......................]          ramsey.sent_item  490MB/6.46GB   (7.4%)
2024-07-16T15:17:48.749+0800    [###############.........]  ramsey.sent_item_archive  842MB/1.30GB  (63.4%)
2024-07-16T15:17:48.750+0800
2024-07-16T15:17:51.748+0800    [##......................]          ramsey.sent_item   616MB/6.46GB   (9.3%)
2024-07-16T15:17:51.750+0800    [##################......]  ramsey.sent_item_archive  1014MB/1.30GB  (76.4%)
2024-07-16T15:17:51.753+0800
2024-07-16T15:17:54.853+0800    [##......................]          ramsey.sent_item   719MB/6.46GB  (10.9%)
2024-07-16T15:17:54.854+0800    [####################....]  ramsey.sent_item_archive  1.13GB/1.30GB  (87.1%)
2024-07-16T15:17:54.877+0800
2024-07-16T15:17:57.748+0800    [##......................]          ramsey.sent_item   812MB/6.46GB  (12.3%)
2024-07-16T15:17:57.752+0800    [#######################.]  ramsey.sent_item_archive  1.28GB/1.30GB  (98.9%)
2024-07-16T15:17:57.758+0800
2024-07-16T15:17:58.115+0800    [########################]  ramsey.sent_item_archive  1.30GB/1.30GB  (100.0%)
2024-07-16T15:17:58.115+0800    no indexes to restore
2024-07-16T15:17:58.120+0800    finished restoring ramsey.sent_item_archive (135502 documents)
2024-07-16T15:18:00.748+0800    [###.....................]  ramsey.sent_item  940MB/6.46GB  (14.2%)
2024-07-16T15:18:03.770+0800    [####....................]  ramsey.sent_item  1.09GB/6.46GB  (16.9%)
2024-07-16T15:18:06.748+0800    [####....................]  ramsey.sent_item  1.23GB/6.46GB  (19.0%)
2024-07-16T15:18:09.770+0800    [#####...................]  ramsey.sent_item  1.43GB/6.46GB  (22.1%)
2024-07-16T15:18:12.747+0800    [#####...................]  ramsey.sent_item  1.58GB/6.46GB  (24.5%)
2024-07-16T15:18:15.749+0800    [######..................]  ramsey.sent_item  1.76GB/6.46GB  (27.3%)
2024-07-16T15:18:18.756+0800    [######..................]  ramsey.sent_item  1.87GB/6.46GB  (29.0%)
2024-07-16T15:18:21.747+0800    [#######.................]  ramsey.sent_item  2.06GB/6.46GB  (31.8%)
2024-07-16T15:18:24.800+0800    [########................]  ramsey.sent_item  2.25GB/6.46GB  (34.8%)
2024-07-16T15:18:27.747+0800    [#########...............]  ramsey.sent_item  2.44GB/6.46GB  (37.8%)
2024-07-16T15:18:30.747+0800    [#########...............]  ramsey.sent_item  2.62GB/6.46GB  (40.5%)
2024-07-16T15:18:33.747+0800    [##########..............]  ramsey.sent_item  2.77GB/6.46GB  (42.8%)
2024-07-16T15:18:36.748+0800    [##########..............]  ramsey.sent_item  2.95GB/6.46GB  (45.6%)
2024-07-16T15:18:39.747+0800    [###########.............]  ramsey.sent_item  3.13GB/6.46GB  (48.4%)
2024-07-16T15:18:42.747+0800    [############............]  ramsey.sent_item  3.34GB/6.46GB  (51.7%)
2024-07-16T15:18:45.748+0800    [#############...........]  ramsey.sent_item  3.52GB/6.46GB  (54.5%)
2024-07-16T15:18:48.758+0800    [#############...........]  ramsey.sent_item  3.70GB/6.46GB  (57.3%)
2024-07-16T15:18:51.750+0800    [##############..........]  ramsey.sent_item  3.87GB/6.46GB  (59.9%)
2024-07-16T15:18:54.747+0800    [###############.........]  ramsey.sent_item  4.09GB/6.46GB  (63.3%)
2024-07-16T15:18:57.747+0800    [################........]  ramsey.sent_item  4.31GB/6.46GB  (66.8%)
2024-07-16T15:19:00.784+0800    [################........]  ramsey.sent_item  4.53GB/6.46GB  (70.1%)
2024-07-16T15:19:03.760+0800    [#################.......]  ramsey.sent_item  4.71GB/6.46GB  (72.9%)
2024-07-16T15:19:06.747+0800    [##################......]  ramsey.sent_item  4.94GB/6.46GB  (76.4%)
2024-07-16T15:19:09.747+0800    [###################.....]  ramsey.sent_item  5.13GB/6.46GB  (79.4%)
2024-07-16T15:19:12.747+0800    [###################.....]  ramsey.sent_item  5.34GB/6.46GB  (82.7%)
2024-07-16T15:19:15.844+0800    [####################....]  ramsey.sent_item  5.57GB/6.46GB  (86.2%)
2024-07-16T15:19:18.748+0800    [#####################...]  ramsey.sent_item  5.79GB/6.46GB  (89.7%)
2024-07-16T15:19:21.747+0800    [######################..]  ramsey.sent_item  6.00GB/6.46GB  (92.9%)
2024-07-16T15:19:24.747+0800    [#######################.]  ramsey.sent_item  6.21GB/6.46GB  (96.2%)
2024-07-16T15:19:27.816+0800    [#######################.]  ramsey.sent_item  6.40GB/6.46GB  (99.1%)
2024-07-16T15:19:28.762+0800    [########################]  ramsey.sent_item  6.46GB/6.46GB  (100.0%)
2024-07-16T15:19:28.762+0800    restoring indexes for collection ramsey.sent_item from metadata
2024-07-16T15:20:13.627+0800    finished restoring ramsey.sent_item (676453 documents)
2024-07-16T15:20:13.627+0800    doneC:\Users\administrator>

相关文章:

Mongodb 3.6 数据恢复操作

一、安装MongoDB 忽略 二、创建账号和授权 在新的MongoDB上创建用户管理员。先切换到admin库,然后通过命令创建数据库管理员账号和密码。最后再验证账号密码是否创建成功! use admin db.createUser({user:"root",pwd:"123456Ab",…...

C++ | Leetcode C++题解之第238题除自身以外数组的乘积

题目&#xff1a; 题解&#xff1a; class Solution { public:vector<int> productExceptSelf(vector<int>& nums) {int length nums.size();// L 和 R 分别表示左右两侧的乘积列表vector<int> L(length, 0), R(length, 0);vector<int> answer(l…...

挂耳式蓝牙耳机什么牌子好?这五款综合表现遥遥领先

为什么这几年开放式耳机受到了越来越多消费者的喜爱&#xff1f;我想是因为它全方位的弥补了入耳式耳机堵塞耳朵、不够安全健康的缺陷&#xff0c;真正做到了安全性与舒适性兼得。那么刚入坑开放式耳机的小白该如何挑选一款品质较高的开放式耳机呢&#xff1f;挂耳式蓝牙耳机什…...

防火墙-NAT策略和智能选路

一、背景技术 在日常网络环境&#xff0c;内部网络想要访问外网无法直接进行通信&#xff0c;这时候就需要进行NAT地址转换&#xff0c;而在防火墙上配置NAT和路由器上有点小区别&#xff0c;思路基本一致&#xff0c;这次主要就以防火防火墙配置NAT策略为例&#xff0c;防火墙…...

一键优雅为Ubuntu20.04服务器挂载新磁盘

itopen组织1、提供OpenHarmony优雅实用的小工具2、手把手适配riscv qemu linux的三方库移植3、未来计划riscv qemu ohos的三方库移植 小程序开发4、一切拥抱开源&#xff0c;拥抱国产化 一、小于2T磁盘挂载方式 1.1 安装磁盘到电脑后启动系统 1.2 查找未分区的磁盘 打…...

踩坑日记 | 记一次流程图问题排查

踩坑日记&#xff1a;记一次流程图问题排查 标签&#xff1a; activiti | 流程 引言 今天排查了一个流程图问题&#xff0c;耗时2个小时终于解决&#xff0c;记录下来 现象 流程审批驳回报错&#xff1a;Unknown property used in expression: ${xxxx} 使用的是 activiti …...

数据建设实践之大数据平台(四)安装mysql

安装mysql 卸载mysql [bigdatanode101 ~]$ sudo rpm -qa | grep mariadb | xargs sudo rpm -e --nodeps 上传安装包到/opt/software目录并解压 [bigdatanode101 software]$ tar -xf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar -C mysql_lib/ 到mysql_lib目录下顺序安装 …...

MongoDB常用命令大全,概述、备份恢复

文章目录 一、MongoDB简介二、服务启动停止、连接三、数据库相关四、集合操作五、文档操作六、数据备份与恢复/导入导出数据6.1 mongodump备份数据库6.2 mongorestore还原数据库6.3 mongoexport导出表 或 表中部分字段6.4 mongoimport导入表 或 表中部分字段 七、其他常用命令八…...

uni-app 保存号码到通讯录

1、 添加模块 2、添加权限 3、添加策略 Android&#xff1a; "permissionExternalStorage" : {"request" : "none","prompt" : "应用保存运行状态等信息&#xff0c;需要获取读写手机存储&#xff08;系统提示为访问设备上的照片…...

Jetson-AGX-Orin gstreamer+rtmp+http-flv 推拉流

Jetson-AGX-Orin gstreamerrtmphttp-flv 推拉流 Orin是ubuntu20.04 ARM64架构的系统&#xff0c;自带gstreamer 1、 测试摄像头 测试摄像头可以用v4l2-ctl命令或者用gst-launch-1.0 #用v4l2-ctl测试摄像头,有尖角符号持续打印则正常 v4l2-ctl -d /dev/video0 --set-fmt-vid…...

ES证书过期替换方案

简介&#xff1a; 在生产环境中&#xff0c;Elasticsearch 集群的证书可能会因为过期而导致集群无法正常工作。为了避免这种情况的发生&#xff0c;我们需要及时更新证书&#xff0c;并保证更新证书的过程中保持 Elasticsearch 集群的高可用性和数据安全性。 集群环境 ES集群版…...

计算机网络——网络层(IP地址与MAC地址、地址解析协议ARP、IP数据报格式以及转发分组、ICMP、IPV6)

IP地址与MAC地址 由于MAC地址已固化在网卡上的ROM 中&#xff0c;因此常常将 MAC地址称为硬件地址或物理地址&#xff1b;物理地址的反义词就是虚拟地址、软件地址或逻辑地址&#xff0c;IP地址就属于这类地址。 从层次的角度看&#xff0c;MAC地址是数据链路层使用的地址&…...

音视频入门基础:H.264专题(13)——FFmpeg源码中通过SPS属性获取视频色彩格式的实现

一、引言 通过FFmpeg命令可以获取到H.264裸流文件的色彩格式&#xff08;又译作色度采样结构、像素格式&#xff09;&#xff1a; 在vlc中也可以获取到色彩格式&#xff08;vlc底层也使用了FFmpeg进行解码&#xff09;&#xff1a; 这个色彩格式就是之前的文章《音视频入门基础…...

WEB前端05-JavaScrip基本对象

JavaScript对象 1.Function对象 函数的创建 //方法一&#xff1a;自定义函数 function 函数名([参数]) {函数体[return 表达式] }//方法二&#xff1a;匿名函数 (function([参数]) {函数体[return 表达式] }); **使用场景一&#xff1a;定义后直接调用使用(只使用一次) (fun…...

新手教学系列——简单的服务配置项集中管理

前言 在开发和运维过程中&#xff0c;配置管理是一个非常重要但经常被忽视的环节。常用的配置文件格式包括env、ini和yaml等&#xff0c;它们非常适合模块级别的系统配置&#xff0c;尤其是一些敏感信息的配置&#xff0c;例如数据库连接字符串和密码等。但是&#xff0c;对于…...

《0基础》学习Python——第十三讲__面向对象

<类&#xff08;class&#xff09;> 一、面向对象概念 1、面向对象是一种编程思想和技术&#xff0c;它是一种将程序设计问题分解成对象的方式。每个对象都有自己的状态&#xff08;数据&#xff09;和行为&#xff08;方法&#xff09;&#xff0c;并且可以通过相互之间…...

前端JS特效第42波:纯CSS实现的卡片切换效果

纯CSS实现的卡片切换效果&#xff0c;先来看看效果&#xff1a; 部分核心的代码如下&#xff1a; <!DOCTYPE html> <html lang"zh-CN"><head><meta charset"utf-8"><title>纯CSS实现的卡片切换效果演示</title><l…...

2.10、matlab中字符、数字、矩阵、字符串和元胞合并为字符串并将字符串以不同格式写入读出excel

1、前言 在 MATLAB 中&#xff0c;可以使用不同的数据类型&#xff08;字符、数字、矩阵、字符串和元胞&#xff09;合并为字符串&#xff0c;然后将字符串以不同格式写入 Excel 文件。 以下是一个示例代码&#xff0c;展示如何将不同数据类型合并为字符串&#xff0c;并以不…...

中文科技核心论文发表

中文科技核心论文题目如下&#xff1a; 1.混凝土结构用纤维增强塑料筋的耐久性评述&#xff1a;适合建筑、结构、材料等专业 2.建筑工程用阻燃塑料的研究进展&#xff1a;适合建筑、材料专业 3.纤维增强热塑性塑料在面部护具中的应用研究&#xff1a;适合化工、医学、材料等专…...

使用 Flask 3 搭建问答平台(一):项目结构搭建

一、项目基本结构 二、app.py from flask import Flask import config from exts import db from models import UserModel from blueprints.qa import bp as qa_bp from blueprints.auth import bp as auth_bp# 创建一个Flask应用实例&#xff0c;__name__参数帮助Flask确定应…...

RestClient

什么是RestClient RestClient 是 Elasticsearch 官方提供的 Java 低级 REST 客户端&#xff0c;它允许HTTP与Elasticsearch 集群通信&#xff0c;而无需处理 JSON 序列化/反序列化等底层细节。它是 Elasticsearch Java API 客户端的基础。 RestClient 主要特点 轻量级&#xff…...

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …...

synchronized 学习

学习源&#xff1a; https://www.bilibili.com/video/BV1aJ411V763?spm_id_from333.788.videopod.episodes&vd_source32e1c41a9370911ab06d12fbc36c4ebc 1.应用场景 不超卖&#xff0c;也要考虑性能问题&#xff08;场景&#xff09; 2.常见面试问题&#xff1a; sync出…...

Java多线程实现之Callable接口深度解析

Java多线程实现之Callable接口深度解析 一、Callable接口概述1.1 接口定义1.2 与Runnable接口的对比1.3 Future接口与FutureTask类 二、Callable接口的基本使用方法2.1 传统方式实现Callable接口2.2 使用Lambda表达式简化Callable实现2.3 使用FutureTask类执行Callable任务 三、…...

基于Docker Compose部署Java微服务项目

一. 创建根项目 根项目&#xff08;父项目&#xff09;主要用于依赖管理 一些需要注意的点&#xff1a; 打包方式需要为 pom<modules>里需要注册子模块不要引入maven的打包插件&#xff0c;否则打包时会出问题 <?xml version"1.0" encoding"UTF-8…...

SpringCloudGateway 自定义局部过滤器

场景&#xff1a; 将所有请求转化为同一路径请求&#xff08;方便穿网配置&#xff09;在请求头内标识原来路径&#xff0c;然后在将请求分发给不同服务 AllToOneGatewayFilterFactory import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; impor…...

图表类系列各种样式PPT模版分享

图标图表系列PPT模版&#xff0c;柱状图PPT模版&#xff0c;线状图PPT模版&#xff0c;折线图PPT模版&#xff0c;饼状图PPT模版&#xff0c;雷达图PPT模版&#xff0c;树状图PPT模版 图表类系列各种样式PPT模版分享&#xff1a;图表系列PPT模板https://pan.quark.cn/s/20d40aa…...

Spring AI与Spring Modulith核心技术解析

Spring AI核心架构解析 Spring AI&#xff08;https://spring.io/projects/spring-ai&#xff09;作为Spring生态中的AI集成框架&#xff0c;其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似&#xff0c;但特别为多语…...

蓝桥杯3498 01串的熵

问题描述 对于一个长度为 23333333的 01 串, 如果其信息熵为 11625907.5798&#xff0c; 且 0 出现次数比 1 少, 那么这个 01 串中 0 出现了多少次? #include<iostream> #include<cmath> using namespace std;int n 23333333;int main() {//枚举 0 出现的次数//因…...

鸿蒙DevEco Studio HarmonyOS 5跑酷小游戏实现指南

1. 项目概述 本跑酷小游戏基于鸿蒙HarmonyOS 5开发&#xff0c;使用DevEco Studio作为开发工具&#xff0c;采用Java语言实现&#xff0c;包含角色控制、障碍物生成和分数计算系统。 2. 项目结构 /src/main/java/com/example/runner/├── MainAbilitySlice.java // 主界…...