Wrk性能测试工具

目标

  • wrk 入门
  • 使用 wrk 压测已有接口 写接口测试 读接口测试

wrk 安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Linux
apt install wrk

# MacOS
brew install wrk

# 源码编译安装
git clone https://github.com/wg/wrk.git
# 编译之后得到一个 wrk 可执行文件
cd wrk && make
export {wrk ENV}

命令

MacOS上制作Windows/Ubuntu系统启动盘

1 Windows 11

年前买了一些电脑配配件,今天2025年正月初一在家装系统。

1.1 准备

1.2 步骤

1、 、插入U盘,打开 Mac 上的 Disk Utility

2、点击 【Erase】抹除 U盘,注意 Format 选择 ExFAT

YAML中的锚点和别名

无意间发现yaml提供了一个特别有意思的功能:锚点(&)和别名(*)。可以使用它们来引用 yaml 中一些重复的配置。

yaml 配置如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
defaults: &defaults
  adapter:  postgres
  host:     localhost
 
development:
  database: myapp_development
  <<: *defaults
 
test:
  database: myapp_test
  <<: *defaults

等同下面yaml配置:

宿主机Mac无法Ping通容器IP

背景

  • 宿主机:Mac
  • 容器:在Mac上安装的 CentOS8 容器,容器IP为 172.20.30.1
  • 现象:进入容器中,可以Ping通宿主机Mac的IP,但在宿主机Mac上却无法Ping通容器的IP,提示信息如下:
    1
    2
    3
    4
    
    ✗ ping 172.20.30.1
    PING 172.20.30.1 (172.20.30.1): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    

解决方案

参考

我的

1、首先 Mac 端通过 brew 安装 docker-connector

宿主机Mac启动的Linux容器无法使用systemd

背景

  • 宿主机:Mac

  • 容器:在Mac上安装的 CentOS8 容器

  • 现象:

    1、docker-comose up 启动容器,提示信息如下:

    1
    2
    3
    4
    
    vm-1   |
    vm-1   | Welcome to CentOS Linux 8!
    vm-1   |
    vm-1   | [!!!!!!] Failed to allocate manager object, freezing.
    

    2、进入容器中,无法使用 systemctl 命令,提示信息如下:

jq学习

1 介绍

一个灵活的轻量级命令行JSON处理器。

简单讲,就像一个机器,输入JSON数据,经过加工处理后,产出符合你要求的数据,可提取、可转换或其他大量的标准操作。

常见环境搭建与工具安装

1 开发环境

1.1 Go

Go开发环境搭建

1.2 Protobuf

Protobuf安装

1.3 React Native

  • node
  • watchman
  • VSCode/WebStorm
  • JDK/AndroidStudio/环境变量配置

安装

1
brew install watchman

初始化项目

1
npx react-native init AwesomeProject

1.4 Android

环境变量配置

1
2
3
4
# Android
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools

2 开发工具

2.1 Docker

参考Docker CE镜像

Ceph集群搭建

Ceph 是什么

Ceph 是一个开源的分布式存储系统,提供了对象存储、块存储和文件系统三种存储接口。Ceph 将数据存储在逻辑存储池中,使用 CRUSH 分布式算法决定如何将数据分散存储在集群的各个节点上,以实现高可用性和数据冗余。

搭建Harbor镜像中心

文档

参考

前提条件

硬件

Resource Minimum Recommended
CPU 2CPU 4CPU
Mem 4G 8G
Disk 40G 160G

软件

Resource Minimum Description
Docker Engine Version 20.10.10-ce+ Docker Engine documentation
Docker Compose v1.18.0+ or docker compose v2 Docker Compose documentation
OpenSSL Latest is preferred Used to generate certificate and keys for Harbor

端口

Port protocol Description
443 HTTPS Harbor portal and core API accept HTTPS requests on this port. You can change this port in the configuration file.
4443 HTTPS Connections to the Docker Content Trust service for Harbor. You can change this port in the configuration file.
80 HTTP Harbor portal and core API accept HTTP requests on this port. You can change this port in the configuration file.

下载&解压

下载