上一页 1 2 3 4 5 6 ··· 53 下一页

2025年8月5日

ZooKeeper和Redis对比

摘要: 对比项 ZooKeeper Redis 设计初衷 分布式协调服务(树状层次结构) 高性能内存数据库(KV键值对) 一致性 基于ZAB协议保证强一致性 不支持 通知机制 可靠的一次性通知,需要重新注册watch 非可靠的通知 分布式锁 支持可重入和公平性 支持高性能 阅读全文

posted @ 2025-08-05 07:25 王景迁 阅读(6) 评论(0) 推荐(0)

2025年7月27日

查看Linux所有crontab定时任务

摘要: 查看单个用户的crontab定时任务 crontab -l -u username 查看所有用户的crontab任务 cat /etc/passwd | cut -f 1 -d : |xargs -I {} crontab -l -u {} 阅读全文

posted @ 2025-07-27 08:28 王景迁 阅读(10) 评论(0) 推荐(0)

fatrace查看磁盘io

摘要: fatrace无法查看到执行磁盘IO进程的父进程。 apt install -y fatrace fatrace -c -t 阅读全文

posted @ 2025-07-27 08:17 王景迁 阅读(7) 评论(0) 推荐(0)

go select选择case分析

摘要: 场景 条件 执行default 存在default,且无case满足。 阻塞 没有default,且无case满足。 选择单个case执行 如果只有1个case满足,那么直接执行;如果有多个case满足,那么随机选择执行,通过随机来保证公平性。 阅读全文

posted @ 2025-07-27 07:53 王景迁 阅读(9) 评论(0) 推荐(0)

2025年7月18日

go map不能使用指针作为key

摘要: package main import "fmt" type student struct { name string age int } func main() { m := make(map[*student]bool) s1 := &student{ name: "a", age: 17, } 阅读全文

posted @ 2025-07-18 08:16 王景迁 阅读(10) 评论(0) 推荐(0)

go 设置http请求超时时间

摘要: 10.11.12.13不真实存在,ping会超时。 使用 http.Client 设置全局超时 package main import ( "net/http" "time" ) func main() { client := &http.Client{ Timeout: 5 * time.Seco 阅读全文

posted @ 2025-07-18 08:09 王景迁 阅读(39) 评论(0) 推荐(0)

2025年7月12日

go 切片删除某个元素

摘要: package main import "fmt" func delete(s []int, num int) []int { for i := 0; i < len(s); i++ { if s[i] == num { s = append(s[:i], s[i+1:]...) i-- } } r 阅读全文

posted @ 2025-07-12 17:31 王景迁 阅读(10) 评论(0) 推荐(0)

2025年6月28日

Makefile用途

摘要: 用途1:构建docker镜像 mkdir makefile cd makefile # Dockerfile FROM golang:1.19-alpine AS builder # Makefile build: docker build -t $(tag) . make build tag=a 阅读全文

posted @ 2025-06-28 10:18 王景迁 阅读(11) 评论(0) 推荐(0)

2025年6月22日

go 使用options扩展参数

摘要: package main import ( "fmt" ) type Config struct { path string isUseFile bool } type ConfigOption func(config *Config) error func WithPath(path string 阅读全文

posted @ 2025-06-22 16:17 王景迁 阅读(7) 评论(0) 推荐(0)

go url parse

摘要: url = schema(http/https) + "//" + host(ip:port/domain:port) + path(/xxx) + "?" + rawQuery(xxx=xxx) package main import ( "fmt" "net/url" ) func parseU 阅读全文

posted @ 2025-06-22 11:50 王景迁 阅读(15) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 53 下一页

导航