During the New Year's holiday, I studied some domain-driven design knowledge. Here is a summary. In domain-driven design, layered architecture is an important part, so let's start with layering and gradually understand some concepts in DDD. Data Mapping Layer …

2022年2月14日 2条评论 5226点热度 0人点赞 痴者工良 阅读全文

过年假期在学习了一些领域驱动知识,这里做个汇总。 在领域驱动设计中,程序进行分层,是其重要的一部分,因此这里以分层开始,逐步了解 DDD 中的一些概念。 数据映射层 首先第一步是数据库,数据库这一部分是持久层,负责实体对象和数据库表的映射以及数据库连接配置、数据库上下文配置、ORM 配置等,数据库和缓存它们都是供领域层使用,但是不能直接使用,而是通过仓储的封装。 对于数据库表,在程序中使用实体来对应数据库表,而作为持久层,持久化对象称为 Persistent Object,缩写是 PO,表示持久化的对象。因为实体叫…

2022年2月14日 2条评论 6198点热度 0人点赞 痴者工良 阅读全文

Kubernetes Monitoring When your application is deployed to Kubernetes, it becomes challenging to see what is happening inside the containers. Once a container dies, the data inside it may be permanently lost, and you might not even be able to view the logs to …

2022年2月13日 0条评论 4102点热度 0人点赞 痴者工良 阅读全文

Kubernetes 监控 当你的应用部署到 Kubenetes 后,你很难看到容器内部发生了什么,一旦容器死掉,里面的数据可能就永远无法恢复,甚至无法查看日志以定位问题所在,何况一个应用可能存在很多个实例,用户的一个请求不指定被哪个容器处理了,这使得在 Kubernetes 中对应用进行故障排除较为复杂。在应用之外,由于 Kubernetes 作为基础设施,掌管这整个集群的生死,Kubernetes 的任何故障,必定影响到应用服务的运行,因此监控 Kubernetes 运行状况也至关重要。 当你的应用上了云原生,…

2022年2月13日 0条评论 3406点热度 0人点赞 痴者工良 阅读全文

Database Sharding Generally speaking, database sharding has the following methods: Hash-based sharding: Calculating the hash value based on the identifier of a data item and allocating it to a specific database engine. Range-based sharding: Allocating a data i…

2022年2月6日 0条评论 3835点热度 0人点赞 痴者工良 阅读全文

分库分表 一般来说,数据库分库分表,有以下做法: 按哈希分片:根据一条数据的标识计算哈希值,将其分配到特定的数据库引擎中; 按范围分片:根据一条数据的标识(一般是值),将其分配到特定的数据库引擎中; 按列表分片:根据某些字段的标识,如果符合条件则分配到特定的数据库引擎中。 分库分表的做法有很多种,例如编写代码库,在程序中支持多数据库,程序需要知道每个数据库的地址,并要编写代码进行支持;使用中间件将多个数据库引擎连接起来,程序只需要知道中间件地址。 但是分库分表后,因为任意两个表可能在不同的数据库实例中,两个表进行连…

2022年2月6日 0条评论 4773点热度 0人点赞 痴者工良 阅读全文

What to Write Not long ago, I wrote a project using C#, which utilizes the Kubernetes API Server to retrieve information and monitor Kubernetes resources, then combines it with Neting to create an API gateway. Experience link: http://neting.whuanle.cn:30080/ A…

2022年1月24日 0条评论 1324点热度 2人点赞 痴者工良 阅读全文

写什么呢 前段时间使用 C# 写了个项目,使用 Kubernetes API Server,获取信息以及监控 Kubernetes 资源,然后结合 Neting 做 API 网关。 体验地址 http://neting.whuanle.cn:30080/ 账号 admin,密码 admin123 本篇文章主要介绍,如何通过 C# 开发基于 Kuberetes 的应用,实现获取 Kubernets 中各种资源的信息,以及实现 Conroller 的前提知识。而在下一篇中则会讲解如何实现 Conroller 和 Kub…

2022年1月24日 0条评论 3745点热度 2人点赞 痴者工良 阅读全文

rsync is a data mirroring and backup tool for Linux systems. Using the fast incremental backup tool Remote Sync allows for remote synchronization, supporting local copying or synchronization with other SSH or rsync hosts. rsync can mirror an entire directory t…

2022年1月21日 0条评论 1406点热度 0人点赞 痴者工良 阅读全文

rsync 是 linux 系统下的数据镜像备份工具。使用快速增量备份工具Remote Sync可以远程同步,支持本地复制,或者与其他 SSH、rsync 主机同步。 rsync 可以镜像保存整个目录树和文件系统。可以很容易做到保持原来文件的权限、时间、软硬链接等等。无须特殊权限即可安装。 快速:第一次同步时 rsync 会复制全部内容,但在下一次只传输修改过的文件。rsync 在传输数据的过程中可以实行压缩及解压缩操作,因此可以使用更少的带宽。 安全:可以使用scp、ssh等方式来传输文件,当然也可以通过直接的s…

2022年1月21日 0条评论 5159点热度 0人点赞 痴者工良 阅读全文

首先要安装 mysqlclient,apt install mysql-client。 然后使用里面的 mysqldump 工具。 命令格式示例如下 mysqldump -h127.0.0.1 --port=端口 -uroot -p密码 --databases 数据库名称 > /var/bak/aaa.sql 不得不说备份速度极快。 示例命令: filename=`date +%Y%m%d_%H%M%S` mysqldump -h127.0.0.1 --port=3306 -uroot -p123456 --…

2022年1月21日 2条评论 4401点热度 0人点赞 痴者工良 阅读全文

首先要安装 mysqlclient,apt install mysql-client。 然后使用里面的 mysqldump 工具。 命令格式示例如下 mysqldump -h127.0.0.1 --port=端口 -uroot -p密码 --databases 数据库名称 > /var/bak/aaa.sql 不得不说备份速度极快。 示例命令: filename=<code>date +%Y%m%d_%H%M%S</code> mysqldump -h127.0.0.1 --port=…

2022年1月21日 2条评论 4593点热度 0人点赞 痴者工良 阅读全文

Recently, I migrated my blog system, which involved Nginx, SSL certificates, a MySQL database, and various WordPress files. After quite a bit of effort, to avoid potential issues with server failures in the future, I started a Raspberry Pi at home and used rsy…

2022年1月21日 0条评论 4272点热度 0人点赞 痴者工良 阅读全文

最近将博客系统迁移,有 Nginx,ssl证书,mysql数据库和 wordpress 各类文件,折腾了一番。 为了避免后续服务器故障等问题,在家里启动树莓派,对博客所在的服务器使用 rsync 做定期备份。 树莓派使用自带的 cron 服务,做定期启动任务。 打开 /etc/cron.d 目录,然后创建一个文件,文件不需要后缀名称。 如:bakblog。 文件内容分为三部分,cron时间表达式 + 以某个用户启动任务 + 执行的命令。 但是 这里 cron 的时间表达式,是 5 位,没有 秒和周。 示例如下,此任…

2022年1月21日 0条评论 4365点热度 0人点赞 痴者工良 阅读全文

About Neting Initially, I planned to use Microsoft's official Yarp library to implement an API gateway, but later found it quite cumbersome and decided to abandon that approach. Currently, I have completed the basic functionalities, such as viewing Kubernetes …

2022年1月17日 0条评论 1256点热度 0人点赞 痴者工良 阅读全文

关于 Neting 刚开始的时候是打算使用微软官方的 Yarp 库,实现一个 API 网关,后面发现坑比较多,弄起来比较麻烦,就放弃了。目前写完了查看 Kubernetes Service 信息、创建 Route 和 Cluster 和绑定 Kubernetes Service。简单来说,就是完成了基础部分,配置路由和后端服务绑定,如果想实现动态路由和直接转发等功能,只需要按照官方的文档,增加中间件即可。 原本打算使用 .NET 6 的 AOT(一共40MB) ,但是打包运行会容易出现一些依赖问题和环境问题,因此放…

2022年1月17日 0条评论 3861点热度 0人点赞 痴者工良 阅读全文

HammerDB is a database stress testing tool, download link: https://www.hammerdb.com/download.html HammerDB is a leading benchmark and load testing software for some of the most popular databases in the world, supporting Oracle Database, SQL Server, IBM Db2, My…

2022年1月17日 1条评论 6626点热度 1人点赞 痴者工良 阅读全文

Hammerdb 是一个数据库压力测试工具,下载地址: https://www.hammerdb.com/download.html HammerDB 是领先的基准测试和负载测试软件,适用于世界上最流行的数据库,支持 Oracle 数据库、SQL Server、IBM Db2、MySQL、MariaDB 和 PostgreSQL。 TPROC-C 基准测试; TPROC-H 全套测试; 首先创建需要的数据库测试,然后 点击 Schema Build - Options ,配置数据库连接。这里笔者创建的是 TPROC…

2022年1月17日 1条评论 8196点热度 1人点赞 痴者工良 阅读全文

Installed Mysql/MariaDB, but I cannot log in as root; I can only use the mysql account to get in. [root@192-168-0-241 ~]# mysql -u mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 10.3.32-MariaDB-…

2022年1月13日 1条评论 6010点热度 2人点赞 痴者工良 阅读全文

安装了 Mysql/MariaDB ,但是 root 死活进不去,只能用 mysql 这个账号进去。 [root@192-168-0-241 ~]# mysql -u mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 10.3.32-MariaDB-log MariaDB Server Copyright (c) 2000, 2018, Or…

2022年1月13日 1条评论 6942点热度 2人点赞 痴者工良 阅读全文
1192021222354