<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Leo的技术分享</title><description>AI, LLM, Agent, 分布式, 架构, C++, Python, Java, 微服务</description><link>https://leehao.me/</link><item><title>Antigravity Skills 使用指南</title><link>https://leehao.me/posts/antigravity-skills-guide/</link><guid isPermaLink="true">https://leehao.me/posts/antigravity-skills-guide/</guid><description>最新版本 Antigravity 已支持 Agent Skills，本文介绍在 Antigravity 上如何安装和使用 Skills。</description><pubDate>Tue, 03 Mar 2026 09:20:23 GMT</pubDate></item><item><title>利用 Anthropic API 200 行代码实现一个 Claude Code</title><link>https://leehao.me/posts/build-a-claude-code-with-anthropic-api-200-lines/</link><guid isPermaLink="true">https://leehao.me/posts/build-a-claude-code-with-anthropic-api-200-lines/</guid><description>从 Anthropic Messages API 入手，结合 DeepSeek 兼容接口，用约 200 行 Python 实现一个可调用工具的简易 Claude Code。</description><pubDate>Thu, 19 Feb 2026 15:48:47 GMT</pubDate></item><item><title>使用 obsidian-skills 创建可视化笔记</title><link>https://leehao.me/posts/obsidian-skills-visual-notes-guide/</link><guid isPermaLink="true">https://leehao.me/posts/obsidian-skills-visual-notes-guide/</guid><description>介绍如何在 Claude Code 使用 obsidian-skills，创建 Obsidian 的 Canvas、Markdown 笔记和 Bases 视图。</description><pubDate>Sun, 11 Jan 2026 12:53:31 GMT</pubDate></item><item><title>ChatGPT Next Web 打造个人专属 ChatGPT</title><link>https://leehao.me/posts/chatgpt-next-web-build-personal-chatgpt/</link><guid isPermaLink="true">https://leehao.me/posts/chatgpt-next-web-build-personal-chatgpt/</guid><description>概览 当前 ChatGPT 大为流行，可以说是火爆全网。为了体验 ChatGPT，不少用户可能采用在代理网站充值的方式使用。 其实，开源社区已有不少 ChatGPT 的使用方案，例如，https://poe.com/ 提供基于多种模型的智能问答服务，可以供用户直接免费体验使用。 ChatGPT...</description><pubDate>Fri, 05 May 2023 15:20:53 GMT</pubDate></item><item><title>Go 并发：Channel 通道</title><link>https://leehao.me/posts/go-concurrency-channel/</link><guid isPermaLink="true">https://leehao.me/posts/go-concurrency-channel/</guid><description>在上一篇文章《Go 并发机制：Goroutine》中，我们讨论了 Go 如何使用 goroutine 实现并发。本文我们继续讨论 goroutine 如何利用 channel 来进行通信。 什么是 channel Channel，通道，可看作是 goroutine 进行通信的管道（pipe）。...</description><pubDate>Mon, 07 Feb 2022 20:28:26 GMT</pubDate></item><item><title>Go 并发机制：Goroutine</title><link>https://leehao.me/posts/go-concurrency-mechanism-goroutine/</link><guid isPermaLink="true">https://leehao.me/posts/go-concurrency-mechanism-goroutine/</guid><description>Go 是当前一门热门的编程语言，其优秀的并发特性吸引了无数程序员的目光。 Go 的并发特性是一个比较大的话题，笔者计划从以下三个方面讨论： Go goroutine Go channel Go select 本文讨论 Go 的 goroutine 并发机制。 并发与并行 在讨论 gorouti...</description><pubDate>Sat, 08 Jan 2022 23:42:55 GMT</pubDate></item><item><title>Apache Bench ab 性能测试工具入门简介</title><link>https://leehao.me/posts/apache-bench-ab-performance-testing-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/apache-bench-ab-performance-testing-introduction/</guid><description>Apache Bench，即  工具，是 Apache 提供的用来对 HTTP Web 服务器进行性能测试的工具。 命令不仅可以对传统的 Apache Web 服务器进行性能测试，也可以对其他的 Web 服务器进行性能测试，使用起来十分方便。 安装 在笔者 MacBook 上， 工具已安装好。...</description><pubDate>Sun, 26 Dec 2021 16:04:45 GMT</pubDate></item><item><title>Raft 共识算法学习笔记 三：成员变更</title><link>https://leehao.me/posts/raft-consensus-algorithm-study-notes-3-membership-change/</link><guid isPermaLink="true">https://leehao.me/posts/raft-consensus-algorithm-study-notes-3-membership-change/</guid><description>文章 《Raft 共识算法学习笔记 一：领导人选举》 和 《Raft 共识算法学习笔记 二：日志复制》 分别讲述了 Raft 算法如何进行领导人选举和如何进行日志复制。 这篇文章继续讲述 Raft 算法如何处理集群成员节点变更的问题。 考虑一种场景，原来 Raft 集群中存在三个节点，现在需要...</description><pubDate>Fri, 26 Feb 2021 16:09:43 GMT</pubDate></item><item><title>Raft 共识算法学习笔记 二：日志复制</title><link>https://leehao.me/posts/raft-consensus-algorithm-study-notes-2-log-replication/</link><guid isPermaLink="true">https://leehao.me/posts/raft-consensus-algorithm-study-notes-2-log-replication/</guid><description>文章 Raft 共识算法学习笔记 一：领导人选举 描述了 Raft 算法如何进行领导者选举，本文描述 Raft 共识算法如何进行日志复制。 复制状态机 在 Raft 集群中，每个服务器可以看成是一个复制状态机（Replicated State Machine），如下图。 复制状态机通常基于复制...</description><pubDate>Mon, 22 Feb 2021 09:42:56 GMT</pubDate></item><item><title>Raft 共识算法学习笔记 一：领导者选举</title><link>https://leehao.me/posts/raft-consensus-algorithm-study-notes-1-leader-election/</link><guid isPermaLink="true">https://leehao.me/posts/raft-consensus-algorithm-study-notes-1-leader-election/</guid><description>Raft 算法是现在分布式系统开发首选的共识算法。文章 《图解 Paxos 算法》 介绍了 Paxos 共识算法，绝大多数选用 Paxos 算法的系统（比如 Cubby），都是在 Raft 算法发布前开发的，当时没得选。新系统绝大多数选择了 Raft 算法，例如，Etcd，Consul，等。就...</description><pubDate>Mon, 15 Feb 2021 17:05:45 GMT</pubDate></item><item><title>图解 Paxos 算法</title><link>https://leehao.me/posts/illustrated-paxos-algorithm/</link><guid isPermaLink="true">https://leehao.me/posts/illustrated-paxos-algorithm/</guid><description>Paxos 算法由 Leslie Lamport 在 1989 年提出的一个分布式共识算法，Paxos 算法较难理解，本文尝试以图形化方案解释 Paxos 算法。 本文在很大篇幅参考了韩健极客时间的课程《分布式协议与算法》，有兴趣了解韩老师其他课程的同学可以购买来学习下。 Lamport 提出...</description><pubDate>Tue, 02 Feb 2021 22:09:53 GMT</pubDate></item><item><title>Spring Cloud Gateway 网关</title><link>https://leehao.me/posts/spring-cloud-gateway-gateway/</link><guid isPermaLink="true">https://leehao.me/posts/spring-cloud-gateway-gateway/</guid><description>Spring Cloud 在最新版本  开始，已去除了 Zuul 网关的使用，改用 Spring Cloud Gateway 作为网关。 Spring Cloud Gateway 基于 Spring WebFlux 框架实现，相对于 Zuul 来说，性能更高。 本文讲述如何在 Spring C...</description><pubDate>Sun, 24 Jan 2021 17:06:59 GMT</pubDate></item><item><title>Spring Cloud + MyBatis + Druid 动态数据源实现</title><link>https://leehao.me/posts/spring-cloud-mybatis-druid-dynamic-datasource-implementation/</link><guid isPermaLink="true">https://leehao.me/posts/spring-cloud-mybatis-druid-dynamic-datasource-implementation/</guid><description>最近公司某项目计划对数据库进行水平分库处理，因此需要实现程序根据参数自动切换数据库的功能。 本文讲述如何在 Spring Cloud MyBatis Druid Oracle 环境下实现动态数据源切换的功能。 配置数据源 在两个 Oracle 数据库创建  表，并插入几行数据： 为便于标识不同...</description><pubDate>Fri, 22 Jan 2021 14:16:07 GMT</pubDate></item><item><title>Spring Cloud 使用 Nacos 作注册中心</title><link>https://leehao.me/posts/spring-cloud-using-nacos-as-registry-center/</link><guid isPermaLink="true">https://leehao.me/posts/spring-cloud-using-nacos-as-registry-center/</guid><description>文章 《Spring Cloud 使用 Nacos 作配置中心》 描述了如何在 Spring Cloud 使用 Nacos 作配置中心的使用方法，本文在此基础上，使用 Nacos 作为 Spring Cloud 的注册中心。 安装 Nacos 为简单起见，这里使用单机版本的 Nacos Ser...</description><pubDate>Mon, 18 Jan 2021 16:53:24 GMT</pubDate></item><item><title>Spring Cloud 使用 Nacos 作配置中心</title><link>https://leehao.me/posts/spring-cloud-using-nacos-as-config-center/</link><guid isPermaLink="true">https://leehao.me/posts/spring-cloud-using-nacos-as-config-center/</guid><description>Nacos 是 Spring Cloud Alibaba 核心组件之一，可以用作 Spring Cloud 的注册中心和配置中心。 本文讲述如何在 Spring Cloud 中使用 Nacos 作为配置中心。 安装  Nacos 与 Spring Cloud Config 和 Eureka 的...</description><pubDate>Thu, 14 Jan 2021 18:35:39 GMT</pubDate></item><item><title>Spring Boot Druid 使用教程</title><link>https://leehao.me/posts/spring-boot-druid-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/spring-boot-druid-tutorial/</guid><description>阿里巴巴开源的 Druid 是 Java 语言的数据库连接池，提供了强大的监控和扩展功能。 本文讲述如何在 Spring Boot 项目中使用 Druid 数据库连接池。 教程基于文章 《Spring Boot MyBatis 学习教程》 配套的源代码进行扩展，添加 Druid 数据库连接池和...</description><pubDate>Tue, 12 Jan 2021 18:35:02 GMT</pubDate></item><item><title>Spring Boot MyBatis 学习教程</title><link>https://leehao.me/posts/spring-boot-mybatis-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/spring-boot-mybatis-tutorial/</guid><description>MyBatis 是一款优秀的持久层框架，它支持自定义 SQL，存储过程以及高级映射。MyBatis 可以通过简单的 XML 或注解来配置和映射原始类型、接口和 Java POJO（Plain Old Java Objects）为数据库中的记录。 本文讲述如何在 Spring Boot 框架中基...</description><pubDate>Mon, 11 Jan 2021 21:01:30 GMT</pubDate></item><item><title>编译防火墙—— C++ 的 Pimpl惯用法解析</title><link>https://leehao.me/posts/compilation-firewall-cpp-pimpl-idiom-explained/</link><guid isPermaLink="true">https://leehao.me/posts/compilation-firewall-cpp-pimpl-idiom-explained/</guid><description>Pimpl（pointer to implementation, 指向实现的指针）是一种常用的，用来对“类的接口与实现”进行解耦的方法。这个技巧可以避免在头文件中暴露私有细节（见下图 1），因此是促进 API 接口与实现保持完全分离的重要机制。但是 Pimpl 并不是严格意义上的设计模式（它是...</description><pubDate>Fri, 08 Jan 2021 09:00:38 GMT</pubDate></item><item><title>Spring Boot 多线程使用</title><link>https://leehao.me/posts/spring-boot-multithreading-usage/</link><guid isPermaLink="true">https://leehao.me/posts/spring-boot-multithreading-usage/</guid><description>Spring Boot 提供了非常优雅地使用多线程执行任务的方式，本文说明 Spring Boot 项目如何利用   来使用多线程。 创建 Spring Boot 项目 使用 IntelliJ Idea 创建向导创建一个 Spring Boot 项目，或者在 Spring 官网创建一个 Spr...</description><pubDate>Wed, 06 Jan 2021 09:18:42 GMT</pubDate></item><item><title>OpenResty 入门教程</title><link>https://leehao.me/posts/openresty-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/openresty-tutorial/</guid><description>OpenResty 是一款基于 Nginx 和 Lua 的高性能 Web 框架，可以方便地基于 Nginx 进行二次开发，以实现超高并发 Web 网关，Web 服务等。 本文讲述如何在 Linux 安装和使用 OpenResty。 安装 OpenResty OpenResty 官方提供源代码编...</description><pubDate>Fri, 11 Dec 2020 22:31:37 GMT</pubDate></item><item><title>Nginx 模块开发 Hello World</title><link>https://leehao.me/posts/nginx-module-development-hello-world/</link><guid isPermaLink="true">https://leehao.me/posts/nginx-module-development-hello-world/</guid><description>最近在研究如何利用 Nginx 实现高性能网关，这里记录一下开发 Nginx 扩展模块 Hello World。 编译安装 Nginx 下载 Nginx 源代码，解压，进入源代码目录： 编译，安装 Nginx 到指定目录： 命令中使用了参数  是指将 Nginx 安装到目录 。 修改 ，调整 ...</description><pubDate>Fri, 11 Dec 2020 22:28:49 GMT</pubDate></item><item><title>Nginx 作 WebService 反向代理</title><link>https://leehao.me/posts/nginx-as-webservice-reverse-proxy/</link><guid isPermaLink="true">https://leehao.me/posts/nginx-as-webservice-reverse-proxy/</guid><description>WebService 对外提供 SOAP 接口，SOAP 接口基于 HTTP XML，因此，可以使用 Nginx 作用 WebService 的反向代理，以实现 WebService 请求的负载均衡功能。 本文使用 docker-compose 部署 nginx，有关 docker-compo...</description><pubDate>Tue, 08 Dec 2020 10:48:02 GMT</pubDate></item><item><title>Hexo 网站支持 HTTP/2</title><link>https://leehao.me/posts/hexo-website-supports-http-2/</link><guid isPermaLink="true">https://leehao.me/posts/hexo-website-supports-http-2/</guid><description>HTTP/2 具有以下的特性： 采用二进制传输数据 基于流的多路复用 头部压缩 服务端推送 由于 HTTP/2 可以提升网站访问速度，因此，本人决定对个人站点 Leo 的博客 进行 HTTP/2 升级改造。 leehao.me 网站采用 Ngninx Hexo NexT 实现，有关部署细节可以...</description><pubDate>Tue, 01 Dec 2020 22:30:51 GMT</pubDate></item><item><title>CMake 入门教程</title><link>https://leehao.me/posts/cmake-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/cmake-tutorial/</guid><description>文章 CMake 语言 15 分钟入门教程 介绍了 CMake 语言的基础知识，本文在此基础上，进一步说明说明如何利用 CMake 生成 Makefile，并实现编译安装功能。 CMake 除了可以生成 Makefile 外，还可以生成以下 IDE 的编译文件： Xcode Visual St...</description><pubDate>Sun, 29 Nov 2020 10:21:58 GMT</pubDate></item><item><title>GitLab 实现 C++ 项目持续集成</title><link>https://leehao.me/posts/gitlab-cpp-continuous-integration/</link><guid isPermaLink="true">https://leehao.me/posts/gitlab-cpp-continuous-integration/</guid><description>Gitlab 集成了 CI / CD （Continuous Integration，持续集成 / Continuous Delivery，持续交付）功能。下图是 gitlab 官网上有关 ci / cd 各阶段的图示： 本文重点讲述如何利用 gitlab 实现 c+项目的持续集成。 安装 g...</description><pubDate>Thu, 19 Nov 2020 20:50:55 GMT</pubDate></item><item><title>CMake 语言 15 分钟入门教程</title><link>https://leehao.me/posts/cmake-language-15-minute-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/cmake-language-15-minute-tutorial/</guid><description>cmake 是一个跨平台的编译安装工具，可以用简单的语句来描述所有平台的编译安装过程。 本文介绍 cmake 的基础语法。 第一个例子 使用任意的文本编辑器，输入： 然后保存为   文本文件，执行： 输出： &gt; Hello world! 所有变量都是字符串 在 cmake 中，所有变量都是字符...</description><pubDate>Wed, 18 Nov 2020 13:41:43 GMT</pubDate></item><item><title>Dubbo 入门应用程序</title><link>https://leehao.me/posts/dubbo-getting-started-application/</link><guid isPermaLink="true">https://leehao.me/posts/dubbo-getting-started-application/</guid><description>Dubbo 是一款微服务框架，提供高性能 RPC 通信，服务发现，流量管理等服务治理能力，提供构建大规模微服务集群所需的整套解决方案。 本文讲述如何利用 Dubbo 快速构建一个完整的服务端 客户端程序，包括基于 XML，注解和 API 的方式实现一个 Dubbo 的 demo。 配置开发环境...</description><pubDate>Wed, 11 Nov 2020 21:37:21 GMT</pubDate></item><item><title>k8s 部署 nginx 入门</title><link>https://leehao.me/posts/k8s-deploy-nginx-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/k8s-deploy-nginx-introduction/</guid><description>文章 《Mac docker desktop 搭建 kubernetes 环境》 介绍了如何在 mac 上利用 docker desktop 搭建 k8s 运行环境，本文在此基础上，说明如何利用 k8s 部署 nginx 。 创建 pod pod 是 k8s 最小的编排单位，通常来说不需要直接...</description><pubDate>Wed, 04 Nov 2020 18:32:03 GMT</pubDate></item><item><title>Mac docker desktop 搭建 kubernetes 环境</title><link>https://leehao.me/posts/mac-docker-desktop-setup-kubernetes-environment/</link><guid isPermaLink="true">https://leehao.me/posts/mac-docker-desktop-setup-kubernetes-environment/</guid><description>学习 kubernetes （下文简称为 k8s）的前提是需要一个 k8s 运行环境。k8s 官网上推荐使用 minikube 开始 k8s 的学习之旅。由于自己的 mac 上已安装了 docker desktop（下文简称 desktop），且 desktop 集成了 kubernetes ...</description><pubDate>Mon, 02 Nov 2020 09:01:27 GMT</pubDate></item><item><title>filebeat 日志输出至 kafka</title><link>https://leehao.me/posts/filebeat-logs-to-kafka/</link><guid isPermaLink="true">https://leehao.me/posts/filebeat-logs-to-kafka/</guid><description>[Filebeat]( https://www.elastic.co/cn/beats/filebeat) 是一款轻量级的日志采集器，可以用来收集日志，并将日志汇总起来处理。 Filebeat 的工具原理如下图所示： &lt;small&gt;图片来源： https://www.elastic.co/gu...</description><pubDate>Mon, 02 Nov 2020 08:57:13 GMT</pubDate></item><item><title>Kafka 生产者和消费者学习笔记</title><link>https://leehao.me/posts/kafka-producer-and-consumer-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/kafka-producer-and-consumer-learning-notes/</guid><description>最近搭建 kafka 集群环境以便于收集应用程序日志并进行个性化的处理，因此学习了 kafka 生产者和消费者 python 程序的实现。这篇文章当是 kafka 的学习笔记。 一、搭建 kafka 集群 为方便测试，我们在 MacOS 单机上搭建具有三个 kafka 节点的集群。如果在生产上...</description><pubDate>Mon, 06 Jul 2020 20:14:13 GMT</pubDate></item><item><title>使用 prometheus python 库编写自定义指标</title><link>https://leehao.me/posts/using-prometheus-python-library-to-write-custom-metrics/</link><guid isPermaLink="true">https://leehao.me/posts/using-prometheus-python-library-to-write-custom-metrics/</guid><description>虽然 prometheus 已有大量可直接使用的 exporter 可供使用，以满足收集不同的监控指标的需要。例如，node exporter 可以收集机器 cpu，内存等指标，cadvisor 可以收集容器指标。然而，如果需要收集一些定制化的指标，还是需要我们编写自定义的指标。 本文讲述如何...</description><pubDate>Mon, 06 Jul 2020 20:12:44 GMT</pubDate></item><item><title>prometheus 发送企业微信</title><link>https://leehao.me/posts/prometheus-send-wechat-work/</link><guid isPermaLink="true">https://leehao.me/posts/prometheus-send-wechat-work/</guid><description>最近在公司搭建 prometheus 监控平台。文章 《Prometheus 使用阿里云邮件推送发送告警邮件》 已说明如何实现 prometheus 发送邮件告警的功能，这篇文章说明如何实现发送企业微信告警的功能。 申请企业微信账号 为实现发送企业微信告警消息，需要一个企业微信账号，在页面 企...</description><pubDate>Mon, 06 Jul 2020 20:10:29 GMT</pubDate></item><item><title>C++ Lambda 学习笔记</title><link>https://leehao.me/posts/cpp-lambda-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/cpp-lambda-learning-notes/</guid><description>C+中，对于一个对象或一个表达式，如果可以对其使用调用运算符（），则称它是可调用的。即，如果  是可调用的，则可以这样使用： 其中， 是一个逗号分隔的一个或多个参数的列表。 C+中可调用对象除了我们熟悉的函数或函数指针外，还包括函数对象以及 lambda 表达式。 本文重点讲述 lambda ...</description><pubDate>Fri, 01 May 2020 19:39:15 GMT</pubDate></item><item><title>C++ 函数对象学习笔记</title><link>https://leehao.me/posts/cpp-function-object-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/cpp-function-object-learning-notes/</guid><description>函数对象本质上是一个类对象，它重载了函数调用运算符 。调用运算符的函数体实现函数的功能。 例如，我们定义类 ： 类  包含调用运算符的重载，调用运算符的函数体实现了函数的功能：小于操作。 调用运算符的定义第一次看起来有点令人迷惑，因为出现了两个小括号。第一个小括号： 告诉编译器我们在重载调用运...</description><pubDate>Fri, 01 May 2020 19:37:50 GMT</pubDate></item><item><title>Prometheus 使用阿里云邮件推送发送告警邮件</title><link>https://leehao.me/posts/prometheus-use-aliyun-email-push-to-send-alert-emails/</link><guid isPermaLink="true">https://leehao.me/posts/prometheus-use-aliyun-email-push-to-send-alert-emails/</guid><description>我们在文章 《使用 docker-compose 搭建 prometheus 监控系统》 的基础上，增加 prometheus 的告警功能。 Prometheus 指标的收集存储与告警是分开的，告警功能由 alertmanager 提供。我们需要在 prometheus 定义告警规则，这些规则...</description><pubDate>Fri, 01 May 2020 19:36:00 GMT</pubDate></item><item><title>使用 docker-compose 搭建 prometheus 监控系统</title><link>https://leehao.me/posts/using-docker-compose-to-build-prometheus-monitoring-system/</link><guid isPermaLink="true">https://leehao.me/posts/using-docker-compose-to-build-prometheus-monitoring-system/</guid><description>Prometheus 是当前一套非常流行的开源监控和报警系统，于 2016 年加入了 Clound Native Computing Foundation，是继 kubernates 之后的第二个托管项目。 本文讲述如何使用 docker 快速搭建 prometheus 监控系统。 概览 本文...</description><pubDate>Sun, 16 Feb 2020 22:01:51 GMT</pubDate></item><item><title>使用 gitlab 搭建 docker 私有仓库</title><link>https://leehao.me/posts/using-gitlab-to-build-docker-private-registry/</link><guid isPermaLink="true">https://leehao.me/posts/using-gitlab-to-build-docker-private-registry/</guid><description>我们知道，gitlab 可以用来管理 git 提交的源代码，此外，gitlab 还集成了 docker registry 的功能，可以用来作为一个 docker 镜像私有仓库使用。 启用 gitlab registry 功能 我们假设已安装好 gitlab，具体安装可参考 《使用 docker...</description><pubDate>Wed, 12 Feb 2020 10:28:20 GMT</pubDate></item><item><title>使用 docker 安装 gitlab</title><link>https://leehao.me/posts/install-gitlab-using-docker/</link><guid isPermaLink="true">https://leehao.me/posts/install-gitlab-using-docker/</guid><description>Gitlab 作为开源的 git 代码仓库，功能强大，使用起来非常方便。本文讲述如何使用 docker 来安装 gitlab。 本文假定已安装好 docker，可以输入  来验证是否已正常安装，输出： &gt; Docker version 19.03.5, build 633a0ea 使用 doc...</description><pubDate>Tue, 11 Feb 2020 15:55:32 GMT</pubDate></item><item><title>Docker Compose 入门教程</title><link>https://leehao.me/posts/docker-compose-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/docker-compose-tutorial/</guid><description>Docker compose （以下简称为 compose）可用于定义和运行多容器 docker 应用程序。 通过 compose，我们可以使用 YAML 文件来配置应用程序的服务（services），然后只需要通过一个命令，就可以将配置的所有服务启动起来。 使用 compose 只需要三步：...</description><pubDate>Mon, 10 Feb 2020 09:44:29 GMT</pubDate></item><item><title>Docker 数据持久化</title><link>https://leehao.me/posts/docker-data-persistence/</link><guid isPermaLink="true">https://leehao.me/posts/docker-data-persistence/</guid><description>概览 默认情况下，在 docker 容器（container）内创建的文件或产生的数据都只是保存在容器的可写层，这意味着当容器不存在时，容器内产生的数据也没有保存下来。 Docker 提供两种容器数据持久化的方法，使用这两种方法即使容器不存在时，数据也能持久化下来： Bind mount：bi...</description><pubDate>Thu, 06 Feb 2020 20:07:18 GMT</pubDate></item><item><title>gRPC C++ 入门教程</title><link>https://leehao.me/posts/grpc-cpp-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/grpc-cpp-tutorial/</guid><description>之前曾经写过 Python 使用 gRPC 收发消息的教程，可以参考文章 《体验 gRPC 那些事儿》。最近计划在 C+项目中使用 gRPC，故写一篇文章来记录一下如何使用 C+语言来实现一个简单的 gRPC 服务端和客户端程序。 本教程需要先安装 gRPC，有关 gRPC 的安装教程可以参考...</description><pubDate>Sun, 02 Feb 2020 10:28:29 GMT</pubDate></item><item><title>分布式对象存储服务器 MinIO 牛刀小试</title><link>https://leehao.me/posts/minio-first-try/</link><guid isPermaLink="true">https://leehao.me/posts/minio-first-try/</guid><description>数据存储包括三种类型，分别是块存储，文件存储和对象存储。有关这三种类型的差别，可以参考 对象存储、文件存储和块存储的区别。 MioIO 是一个开源的分布式对象存储系统，非常适合于存储大容量非结构化的数据，例如图片，视频，日志文件，备份数据等。本文讲述如何快速搭建 MioIO 服务端和客户端，以...</description><pubDate>Thu, 23 Jan 2020 08:48:09 GMT</pubDate></item><item><title>携程 Apollo 配置中心初探</title><link>https://leehao.me/posts/apollo-configuration-center-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/apollo-configuration-center-introduction/</guid><description>最近在对开源配置中心进行调研。当前流行的开源配置中心包括 Apollo，Nacos，以及 Disconf。Apollo 应该是当前最流行，所以写篇文章来记录 Apollo 的安装与使用。 Apollo 是携程开源的分布式配置中心，能够集中化管理不同环境，不同集群的配置，配置修改后能够实时推送到...</description><pubDate>Tue, 21 Jan 2020 09:31:45 GMT</pubDate></item><item><title>记一次 socket 通信性能优化过程</title><link>https://leehao.me/posts/socket-communication-performance-optimization/</link><guid isPermaLink="true">https://leehao.me/posts/socket-communication-performance-optimization/</guid><description>上段时间测试人员对某个服务端程序进行了性能压力测试，发现当使用 JMeter 向程序并发发送 100 个请求后，再发送请求，则会出现程序无法响应的现象。想着这个问题比较棘手，就拖了不少时间。最近其他事情少了点，可以专心下来优化这个程序的性能，就着手开干了。 利用 Wireshark 和 Pyt...</description><pubDate>Mon, 13 Jan 2020 09:39:31 GMT</pubDate></item><item><title>一文带你了解 RTO 和 RPO</title><link>https://leehao.me/posts/understanding-rto-and-rpo/</link><guid isPermaLink="true">https://leehao.me/posts/understanding-rto-and-rpo/</guid><description>RTO 和 RPO 都是企业灾难恢复（Disaster Recovery, DR）需要考虑的关键指标，这两个指标可以用来指导企业来制定合适的业务系统服务或数据的恢复方案。 本文介绍 RTO 和 RPO 的概念以及区别。 图：RPO（Recovery point objective） 和 RTO...</description><pubDate>Sun, 12 Jan 2020 21:53:24 GMT</pubDate></item><item><title>Oracle / PL SQL: CURSOR FOR LOOP 使用</title><link>https://leehao.me/posts/oracle-pl-sql-cursor-for-loop-usage/</link><guid isPermaLink="true">https://leehao.me/posts/oracle-pl-sql-cursor-for-loop-usage/</guid><description>FOR LOOP 介绍 为了对游标进行遍历，可以使用  语句实现，语法如下： 对游标进行  遍历时，省去了  的声明，循环每次从查询结果中取出一行结果，当取完后，跳出循环。 1) record 是  语句隐式创建的  类型变量，用于表示对游标遍历中的每一行记录。  变量只可以用于  语句内部。...</description><pubDate>Sun, 25 Aug 2019 21:12:08 GMT</pubDate></item><item><title>SQL JOIN 的使用</title><link>https://leehao.me/posts/sql-join-usage/</link><guid isPermaLink="true">https://leehao.me/posts/sql-join-usage/</guid><description>由于工作需要，现在也开始写一些复杂一点的 sql 了。由于之前对于  与  关键字的使用一直有疑惑，故写一篇文章整理一下，算是对 sql 中各种表联结使用的一个总结。 SQL JOIN 的作用 sql 关键字  与  属于以行方向为单位的集合运算，进行这些集合运算时，会导致记录行数的增加或减少...</description><pubDate>Sun, 21 Apr 2019 20:47:18 GMT</pubDate></item><item><title>贝叶斯公式学习笔记</title><link>https://leehao.me/posts/bayes-theorem-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/bayes-theorem-learning-notes/</guid><description>贝叶斯公式有着广泛的应用。最近重新拿起上学时的教科书——浙大《概率论与数理统计（第三版）》，复习了一遍全概率公式与贝叶斯公式，算是捡起了一些记忆。 本文从条件概率出发，推导出全概率公式以及贝叶斯公式，并以例子说明贝叶斯公式的应用。 条件概率 条件概率研究如何计算事件  已发生的条件下事件  发...</description><pubDate>Sun, 07 Apr 2019 22:28:40 GMT</pubDate></item><item><title>CLion 实现远程调试</title><link>https://leehao.me/posts/clion-remote-debugging/</link><guid isPermaLink="true">https://leehao.me/posts/clion-remote-debugging/</guid><description>CLion 是 JetBrains IDE 全家桶产品之一，可以用来开发 C/C+项目，而 GDB 则可以用来对 C/C+程序进行调试。 作为一款调试器，GDB 为程序开发人员提供了强大的调试功能，但却需要使用命令来执行调试操作，操作起来不是很方便。（有关 GDB 的使用，可以参考文章《GDB...</description><pubDate>Sat, 16 Feb 2019 08:41:16 GMT</pubDate></item><item><title>债券的价格</title><link>https://leehao.me/posts/bond-price/</link><guid isPermaLink="true">https://leehao.me/posts/bond-price/</guid><description>之前一直好奇债券的价格是如何确定的，最近查阅了一些资料，对债券的价格有了初步的了解。这篇文章记录对于债券价格的学习笔记。 一、背景知识 1.1 货币时间价值 货币时间价值是指货币随着时间的推移而发生的增值。衡量货币时间价值大小的指标即是利率。 1.2 终值 终值用来表示货币时间价值的概念。已知...</description><pubDate>Sat, 16 Feb 2019 08:36:32 GMT</pubDate></item><item><title>使用 LaTeX 制作幻灯片</title><link>https://leehao.me/posts/using-latex-to-make-slides/</link><guid isPermaLink="true">https://leehao.me/posts/using-latex-to-make-slides/</guid><description>之前一直好奇大学里老师的那种看起来很专业的幻灯片是怎么制作的，只是知道他们使用 TeX 而一直没有动手实践。本着绝知此事要躬行的精神，决定动手实践一把。 由于在家主要使用 Mac  电脑，故本文讲述如何在 Mac OS 制作 LaTeX 幻灯片。 一、安装 MacTeX MacTeX 是 Te...</description><pubDate>Sun, 27 Jan 2019 22:01:47 GMT</pubDate></item><item><title>Samba 服务器搭建与 Java 客户端实现</title><link>https://leehao.me/posts/samba-server-setup-and-java-client-implementation/</link><guid isPermaLink="true">https://leehao.me/posts/samba-server-setup-and-java-client-implementation/</guid><description>最近需要将原来使用阿里云 OSS 的程序模块改成使用公司内部搭建的文件服务器，由于目前使用的文件不多，且都是一些小文件，经过对比后，决定采用 Samba 来实现文件服务器。 Samba 是一个程序的集合，包括服务器与客户端程序，它允许在 Linux 与 Windows 实现共享文件的功能。本文...</description><pubDate>Thu, 03 Jan 2019 22:14:08 GMT</pubDate></item><item><title>最大回撤线性算法实现</title><link>https://leehao.me/posts/maximum-drawdown-linear-algorithm-implementation/</link><guid isPermaLink="true">https://leehao.me/posts/maximum-drawdown-linear-algorithm-implementation/</guid><description>最大回撤是指投资组合在选定的周期内，任一时间点往后推，可能出现资产净值下降的最大幅度。回撤的意思是指在某一段时期内净值从最高点开始回落到最低点的幅度。最大回撤常用百分率来表示，是一个重要的风险指标。最大回撤的计算公式为 注意这里的与并不一定是最高值与最低值，这里的与要与时间范围内关联起来。 另...</description><pubDate>Tue, 01 Jan 2019 15:38:39 GMT</pubDate></item><item><title>米筐开源量化框架 RQalpha 安装使用</title><link>https://leehao.me/posts/rqalpha-installation-and-usage/</link><guid isPermaLink="true">https://leehao.me/posts/rqalpha-installation-and-usage/</guid><description>RQalpha 是 Ricequant 开源的量化框架，提供数据获取，算法交易，策略回测，实盘模拟，实盘交易，数据分析等功能。RQalpha 的安装过程并不十分友好，本文讲述如何安装 RQalpha。安装环境是 Mac OS 操作系统。 安装步骤 1. 创建虚拟环境 RQalpha 推荐使用虚...</description><pubDate>Sun, 30 Dec 2018 14:27:49 GMT</pubDate></item><item><title>CAP 理论 —— 最通俗的解释</title><link>https://leehao.me/posts/cap-theory-simplest-explanation/</link><guid isPermaLink="true">https://leehao.me/posts/cap-theory-simplest-explanation/</guid><description>CAP 理论是分布式系统的一个基础理论，它描述了任何一个分布式系统最多只能满足以下三个特性中的两个： 一致性（Consistency） 可用性（Availability） 分区容忍性（Partition tolerance） CAP 理论听起来十分抽象，本文尝试以生活中的例子并用通俗易懂的语言...</description><pubDate>Sun, 15 Jul 2018 11:57:51 GMT</pubDate></item><item><title>深入理解 Spring AOP</title><link>https://leehao.me/posts/deep-understanding-of-spring-aop/</link><guid isPermaLink="true">https://leehao.me/posts/deep-understanding-of-spring-aop/</guid><description>AOP，Aspect Oriented Programming，面向切面编程，是指在运行时，动态地将代码切入到类的指定方法、指定位置上的一种编程技术。AOP 是 OOP 的延续，是软件开发中的一个热点，也是 Spring 框架中的一个重要内容。利用 AOP 可以对业务逻辑与横切关注点（cros...</description><pubDate>Thu, 28 Jun 2018 22:53:57 GMT</pubDate></item><item><title>深入理解 Spring 控制反转与依赖注入</title><link>https://leehao.me/posts/deep-understanding-spring-ioc-and-di/</link><guid isPermaLink="true">https://leehao.me/posts/deep-understanding-spring-ioc-and-di/</guid><description>概览 对于 Spring 框架来说，控制反转（Inversion of Control, IoC）和依赖注入（Dependency Injection, DI）是个等同的概念，控制反转是通过依赖注入实现的。在这篇文章中，我们会详细介绍 IoC 和 DI 的概念，然后我们会讨论 Spring 框...</description><pubDate>Tue, 26 Jun 2018 22:05:47 GMT</pubDate></item><item><title>Java 使用 Rserve 实现与 R 的通信</title><link>https://leehao.me/posts/java-using-rserve-to-communicate-with-r/</link><guid isPermaLink="true">https://leehao.me/posts/java-using-rserve-to-communicate-with-r/</guid><description>Rserve 是一个基于 TCP/IP 的服务器程序，它允许其他语言调用 R 语言。由于 Rserve 采用 C/S （客户端/服务器）的调用方式，因此客户端并不需要链接 R 语言库，客户端程序与 R 程序可以实现低耦合的目的。 为调用 R 语言，需要实现一个与 Rserve 通信的客户端程序...</description><pubDate>Wed, 20 Jun 2018 22:30:12 GMT</pubDate></item><item><title>Spring MVC 入门例子</title><link>https://leehao.me/posts/spring-mvc-getting-started-example/</link><guid isPermaLink="true">https://leehao.me/posts/spring-mvc-getting-started-example/</guid><description>Spring Web MVC 是一个建立在 Servlet API 的 Web 框架，它属于 Spring Framework 的产品。Spring Web MVC 名称来源于模块 spring-webmvc ，但它更常用的叫法是 Spring MVC。 本文讲述如何使用 IntelliJ I...</description><pubDate>Mon, 18 Jun 2018 21:48:06 GMT</pubDate></item><item><title>Hibernate 实现增删查改</title><link>https://leehao.me/posts/hibernate-crud-implementation/</link><guid isPermaLink="true">https://leehao.me/posts/hibernate-crud-implementation/</guid><description>Hibernate 是一种 Java 语言下的对象关系映射的解决方案，它为面向对象的领域模型到传统的关系型数据库的映射提供了一个使用方便的框架。 本文讲述如何使用 Hibernate 来实现数据库中基本的增删查改操作。 创建数据库表 为实现我们的例子，我们先创建一个表并插入一些数据。 创建 M...</description><pubDate>Mon, 18 Jun 2018 21:40:42 GMT</pubDate></item><item><title>IntelliJ IDEA 添加 MySQL 图形访问界面</title><link>https://leehao.me/posts/intellij-idea-add-mysql-gui/</link><guid isPermaLink="true">https://leehao.me/posts/intellij-idea-add-mysql-gui/</guid><description>IntelliJ IDEA 不愧为一款强大的 Java IDE，其提供的访问 MySQL 数据库的图形界面也异常的强大。 本文讲述如何配置 IntelliJ IDEA 来添加访问 MySQL 的图形界面。 打开 Database 选项窗口，View Tool windows Database。...</description><pubDate>Mon, 18 Jun 2018 21:35:02 GMT</pubDate></item><item><title>使用 JDBC 连接MySQL</title><link>https://leehao.me/posts/using-jdbc-to-connect-mysql/</link><guid isPermaLink="true">https://leehao.me/posts/using-jdbc-to-connect-mysql/</guid><description>JDBC（Java Database Connectivity，Java数据库连接）是 Java 语言中用来规范客户端程序如何来访问数据库的应用程序接口，提供了诸如查询和更新数据库中数据的方法。 本文讲述如何使用 JDBC 来连接和访问数据库。 为方便引入 JDBC 依赖包，我们创建 Mave...</description><pubDate>Mon, 18 Jun 2018 21:24:38 GMT</pubDate></item><item><title>CentOS 7 安装 MySQL</title><link>https://leehao.me/posts/centos-7-install-mysql/</link><guid isPermaLink="true">https://leehao.me/posts/centos-7-install-mysql/</guid><description>官方推荐使用 yum 源来安装 MySQL，本文讲述如何使用 yum 源来安装 MySQL。 一、添加 MySQL yum 源 可以采用命令来添加 MySQL 源。在 https://dev.mysql.com/downloads/repo/yum/ 页面选择合适 rpm 包，这些 rpm 包...</description><pubDate>Mon, 18 Jun 2018 21:20:47 GMT</pubDate></item><item><title>Python 实现 Shell 脚本功能</title><link>https://leehao.me/posts/python-implement-shell-script-functionality/</link><guid isPermaLink="true">https://leehao.me/posts/python-implement-shell-script-functionality/</guid><description>最近生产环境上发现有服务器进程出现任务堆积的情况，由于一时无法定位出原因，故对堆积的任务数量进行监控。进程日志中已有任务数量的输出，故只需要编写一个脚本读取日志中的任务数量，发现任务数量超过某个阈值就发送告警短信即可。 本想使用 Shell 脚本来实现，没想到 Shell 的语法实在不好掌握，...</description><pubDate>Sun, 20 May 2018 21:18:35 GMT</pubDate></item><item><title>Python 实例方法、类方法和静态方法</title><link>https://leehao.me/posts/python-instance-class-static-methods/</link><guid isPermaLink="true">https://leehao.me/posts/python-instance-class-static-methods/</guid><description>在 Python 中，实例方法（instance method），类方法（class method）与静态方法（static method）经常容易混淆。本文通过代码例子来说明它们的区别。 实例方法 Python 的实例方法用得最多，也最常见。我们先来看 Python 的实例方法。 输出： &gt;...</description><pubDate>Fri, 30 Mar 2018 23:12:45 GMT</pubDate></item><item><title>Hexo 网站配置免费阿里云证书</title><link>https://leehao.me/posts/hexo-website-configuration-free-aliyun-certificate/</link><guid isPermaLink="true">https://leehao.me/posts/hexo-website-configuration-free-aliyun-certificate/</guid><description>原来的个人网站 leehao.me 使用了阿里云的负载均衡服务，因此 HTTPS 证书也是部署在负载均衡服务器上。文章《在阿里云部署 Hexo 网站》介绍了采用负载均衡方式来部署网站的方法。 考虑到网站访问流量不高且为了减少费用，决定不再使用负载均衡服务，而是直接采用单个 ECS 服务器的方式...</description><pubDate>Mon, 05 Mar 2018 21:30:53 GMT</pubDate></item><item><title>Python 装饰器浅析</title><link>https://leehao.me/posts/python-decorators-analysis/</link><guid isPermaLink="true">https://leehao.me/posts/python-decorators-analysis/</guid><description>Python 装饰器是 Python 中常常使用到的一种语法糖，它可以大幅度减少重复代码，使用起来十分方便。另一方面，装饰器的定义往往会导致出现函数重重嵌套的情况，这会给装饰器的实现者带来阅读代码的困难。 本文剖析 Python 装饰器的定义与用法。 不带参数的装饰器 我们先来看一下不带参数的...</description><pubDate>Tue, 20 Feb 2018 09:42:26 GMT</pubDate></item><item><title>Python 名称空间与作用域</title><link>https://leehao.me/posts/python-namespaces-and-scopes/</link><guid isPermaLink="true">https://leehao.me/posts/python-namespaces-and-scopes/</guid><description>这篇文章介绍 Python 的名称空间以及变量的作用域。 Python 的名称 Python 的名称（Name）是对象的一个标识（Identifier）。我们知道，在 Python 里面一切皆对象，名称就是用来引用对象的。说得有点玄乎，我们以例子说明。 例如，在这个语句中，是个存储在内存中的一...</description><pubDate>Sat, 20 Jan 2018 23:10:25 GMT</pubDate></item><item><title>记一次 BUG 的排查过程</title><link>https://leehao.me/posts/bug-troubleshooting-process/</link><guid isPermaLink="true">https://leehao.me/posts/bug-troubleshooting-process/</guid><description>最近生产上上线了一个新的功能，在业务人员使用过程中，通过查看日志我们发现一个诡异的问题。这篇文章记录一下这个问题的排查过程以及解决方法。 存在问题的程序使用了 C 语言的 Redis 客户端 hiredis 来连接和操作 Redis。由于处于分布式的环境，所以我们使用了 Redis 的事务的特...</description><pubDate>Mon, 18 Dec 2017 23:44:52 GMT</pubDate></item><item><title>Nginx 日志接入 Elastic Stack 系统</title><link>https://leehao.me/posts/nginx-log-integration-with-elastic-stack/</link><guid isPermaLink="true">https://leehao.me/posts/nginx-log-integration-with-elastic-stack/</guid><description>文章《搭建 Elastic Stack 日志系统》 描述了如何利用 Kibana，Elasticsearch，Filebeat 来搭建日志系统。本文在上一篇 Elastic Stack 文章的基础上，说明如何将 Nginx 的日志接入 Elastic Stack 日志系统。 为了更新在 Kib...</description><pubDate>Wed, 13 Dec 2017 23:02:32 GMT</pubDate></item><item><title>Nginx 日志改成 JSON 格式</title><link>https://leehao.me/posts/nginx-logs-to-json-format/</link><guid isPermaLink="true">https://leehao.me/posts/nginx-logs-to-json-format/</guid><description>Nginx 日志默认为普通文本的格式，例如，下面是 Nginx 的一行访问日志： 为了便于利用 Elastic Stack 日志平台收集展示 Nginx 的日志，可以将 Nginx 的日志改成 json 的格式。修改后的 json 日志格式如下所示： 为了修改 Nginx 的日志格式改成 js...</description><pubDate>Wed, 13 Dec 2017 23:00:26 GMT</pubDate></item><item><title>Node.js 概览</title><link>https://leehao.me/posts/nodejs-overview/</link><guid isPermaLink="true">https://leehao.me/posts/nodejs-overview/</guid><description>Node.js 是一个开源的项目，可以让 JavaScript 的代码在浏览器之外运行。 我们知道，JavaScript 代码可以在浏览器中运行，它可以访问  window 和 document 这样的全局对象以及其他 API 和库函数。 为了支持 JavaScrip 在浏览器以外的环境运行，...</description><pubDate>Sun, 10 Dec 2017 13:01:13 GMT</pubDate></item><item><title>Python 和 Java 进行 DES 加密和解密</title><link>https://leehao.me/posts/python-and-java-des-encryption-and-decryption/</link><guid isPermaLink="true">https://leehao.me/posts/python-and-java-des-encryption-and-decryption/</guid><description>DES 为 Data Encryption Standard （数据加密标准）的缩写，是一种常见的对称加密算法。有关对称加密与非对称加密的特点及其应用场景，本文就不描述了，读者可以自行 google 。本文说明如何使用 Java 和 Python 两种语言来实现 DES 的加解密。 最近碰到的...</description><pubDate>Sun, 19 Nov 2017 07:55:27 GMT</pubDate></item><item><title>搭建 Elastic Stack 日志系统</title><link>https://leehao.me/posts/build-elastic-stack-logging-system/</link><guid isPermaLink="true">https://leehao.me/posts/build-elastic-stack-logging-system/</guid><description>Elastic Stack 是原 ELK Stack 在 5.0 版本加入 Beats 套件后的新称呼。Elastic Stack 在实时日志处理领域已开成开源界的第一选择。 本文讲述如何搭建 Elastic Stack 日志系统，使用的套件包括 Kibana，Elasticsearch，以及...</description><pubDate>Tue, 07 Nov 2017 22:31:14 GMT</pubDate></item><item><title>GDB 调试</title><link>https://leehao.me/posts/gdb-debugging/</link><guid isPermaLink="true">https://leehao.me/posts/gdb-debugging/</guid><description>GDB 是一个功能强大的调试器，也是 Linux 系统中默认的调试器。GDB 主要提供以下四种功能，这些功能可以方便我们定位程序的 BUG。 启动程序 设置断点 检查程序运行状态，例如查看变量的值 修改程序运行状态，例如修改变量的值 本文简单讲述 GDB 的调试方法。 我们需要调试的程序如下所...</description><pubDate>Fri, 20 Oct 2017 22:11:12 GMT</pubDate></item><item><title>记一次程序优化记录</title><link>https://leehao.me/posts/program-optimization-record/</link><guid isPermaLink="true">https://leehao.me/posts/program-optimization-record/</guid><description>忙了几个月的项目终于在生产环境上上线，虽然接下来还有不少工作需要跟进，但终究不像上段时间那么忙了，因此也就能利用周末的时间，对之前优化程序性能的过程作下记录，也当是个小小的经验总结。 程序的应用场景是往 Redis 写入具有大量记录的二维表，或者从 Redis 读取具有大量记录的二维表数据。由...</description><pubDate>Sun, 03 Sep 2017 10:16:34 GMT</pubDate></item><item><title>使用 Supervisor 来管理 Redis 进程</title><link>https://leehao.me/posts/using-supervisor-to-manage-redis-process/</link><guid isPermaLink="true">https://leehao.me/posts/using-supervisor-to-manage-redis-process/</guid><description>Supervisor 是一个用 Python 实现的进程管理工具，可以很方便地启动，关闭，重启，查看，以及监控进程，当进程由于某种原因崩溃或者被误杀后，可以自动重启并发送事件通知。Supervisor 可谓运维利器，使用 Supervisor 来管理进程，可以提高系统的高可用特性。 随着 Re...</description><pubDate>Wed, 30 Aug 2017 22:23:10 GMT</pubDate></item><item><title>Redis AOF 持久化学习笔记</title><link>https://leehao.me/posts/redis-aof-persistence-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/redis-aof-persistence-learning-notes/</guid><description>文章 Redis 快照持久化学习笔记 介绍 Redis 快照持久化的功能，除了快照持久化外，Redis 还提供了 AOF（Append Only File）持久化功能。与快照持久化通过直接保存 Redis 的键值对数据不同，AOF 持久化是通过保存 Redis 执行的写命令来记录 Redis ...</description><pubDate>Tue, 18 Jul 2017 00:03:12 GMT</pubDate></item><item><title>Redis 快照持久化学习笔记</title><link>https://leehao.me/posts/redis-snapshot-persistence-notes/</link><guid isPermaLink="true">https://leehao.me/posts/redis-snapshot-persistence-notes/</guid><description>Redis 是一种内存数据库，它将数据存储在内存中，所以如果不将数据保存到硬盘中，那么一旦 Redis 进程退出，保存在内存中的数据将会丢失。为此，Redis 提供了两种不同的持久化方法来将数据存储到硬盘里面。一种方法叫做快照（snapshotting），它可以将存在于某一时刻的所有数据写入硬...</description><pubDate>Sun, 09 Jul 2017 17:46:24 GMT</pubDate></item><item><title>夯实基础：Redis 的数据结构介绍</title><link>https://leehao.me/posts/redis-data-structures-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/redis-data-structures-introduction/</guid><description>使用 Redis 这么久，发现自己还没写过一篇有关 Redis 数据结构的文章，从构造 Redis 整个知识体系来说，显示是不完整的。故这篇文章再次让自己回归到 Redis 的五种基本数据结构，除了描述这些数据结构的特点，也介绍如何使用 Redis 命令来操作这些数据结构。 Redis 支持的...</description><pubDate>Wed, 14 Jun 2017 07:24:21 GMT</pubDate></item><item><title>Hiredis 实现 Redis 流水线</title><link>https://leehao.me/posts/hiredis-redis-pipeline-implementation/</link><guid isPermaLink="true">https://leehao.me/posts/hiredis-redis-pipeline-implementation/</guid><description>Pipelining（流水线）允许 Redis 客户端一次向 Redis 发送多个命令，Redis 在接收到这些命令后，按顺序进行处理，然后将请求的处理结果一次性返回给客户端。流水线可以减少客户端与 Redis 之间的网络通信次数来提升 Redis 客户端在发送多个命令时的性能，可谓提升客户端...</description><pubDate>Sat, 10 Jun 2017 11:34:21 GMT</pubDate></item><item><title>Python 使用 ElementTree 模块来处理 XML</title><link>https://leehao.me/posts/python-elementtree-module-xml-processing/</link><guid isPermaLink="true">https://leehao.me/posts/python-elementtree-module-xml-processing/</guid><description>最近使用 Python 来发送 SOAP 请求以测试 Web Service 的性能，由于 SOAP 是基于 XML 的，故免不了需要使用 Python 来处理 XML 数据。在对比了几种方案后，最后选定使用 xml.etree.ElementTree 模块来实现。 这篇文章记录了使用 xml...</description><pubDate>Tue, 06 Jun 2017 23:40:01 GMT</pubDate></item><item><title>SOAP Web Services 简介</title><link>https://leehao.me/posts/soap-web-services-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/soap-web-services-introduction/</guid><description>SOAP（Simple Object Access Protocol）是一种基于 XML 的 web 服务协议。SOAP 是平台独立的，不依赖于特定的语言，例如，我们可以使用 C#，C/C++，或者 Java 语言来实现 SOAP web 服务。 SOAP 的优点 SOAP 的优点有： WS ...</description><pubDate>Sun, 04 Jun 2017 18:58:42 GMT</pubDate></item><item><title>Redis 图形化监控方案 RedisLive 介绍</title><link>https://leehao.me/posts/redis-graphical-monitoring-redislive-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/redis-graphical-monitoring-redislive-introduction/</guid><description>作为一款开源的 Redis 图形化监控工具，RedisLive 提供对 Redis 实例的内存使用情况，接收的客户端命令，接收的请求数量以及键进行监控。RedisLive 的工作原理基于 Redis 的 INFO 和 MONITOR 命令，通过向 Redis 实例发送 INFO 和 MONIT...</description><pubDate>Tue, 30 May 2017 22:36:09 GMT</pubDate></item><item><title>Redis 事务学习笔记</title><link>https://leehao.me/posts/redis-transaction-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/redis-transaction-learning-notes/</guid><description>Redis 为了支持事务，提供了 5 个相关的命令，他们分别是 MULTI，EXEC， WATCH，UNWATCH 和 DISCARD。我们先介绍 MULTI 和 EXEC 的用法，MULTI 和 EXEC 支持了 Redis 的基本事务的用法。接下来介绍 WATCH，UNWATCH 和 DI...</description><pubDate>Wed, 17 May 2017 22:06:20 GMT</pubDate></item><item><title>I/O多路复用之 epoll 系统调用</title><link>https://leehao.me/posts/io-multiplexing-epoll-system-call/</link><guid isPermaLink="true">https://leehao.me/posts/io-multiplexing-epoll-system-call/</guid><description>I/O多路复用除了之前我们提到的和外，epoll 也可以检查多个文件描述符的就绪状态，以达到I/O多路复用的目的。 epoll 系统调用是 Linux 系统专有的，在 Linux 内核 2.6 版本新增，epoll 的主要优点有： 当检查大量的文件描述符时，epoll 的性能比和高很多 epo...</description><pubDate>Sun, 07 May 2017 09:39:49 GMT</pubDate></item><item><title>Redis 性能测试记录</title><link>https://leehao.me/posts/redis-performance-test-record/</link><guid isPermaLink="true">https://leehao.me/posts/redis-performance-test-record/</guid><description>虽然 Redis 本身也提供工具来对 Redis 的性能进行测试，但为了对测试维度自由定制，我们还是通过自己编写脚本的方式来测试。 Redis 的官方文档也提到了，简单的起一个循环，然后在循环中向 Redis 发送操作命令，其实不是对 Redis 进行性能测试，而是对网络延迟进行测试。为了真正...</description><pubDate>Sun, 23 Apr 2017 13:01:44 GMT</pubDate></item><item><title>Redis C 语言客户端 hiredis 的使用</title><link>https://leehao.me/posts/redis-c-client-hiredis-usage/</link><guid isPermaLink="true">https://leehao.me/posts/redis-c-client-hiredis-usage/</guid><description>最近需要使用C++来访问 Redis，查找了一些开源C/C+的 Redis 客户端，发现 hiredis 目前的社区活跃度较高，且比较轻量级，就决定选用这款客户端了。 安装 以 Mac OS 为例，说明如何安装 hiredis。 1. 下载 hiredis 的代码 2. 编译安装 第一个例子 ...</description><pubDate>Fri, 21 Apr 2017 21:11:41 GMT</pubDate></item><item><title>Web 服务架构类型</title><link>https://leehao.me/posts/web-service-architecture-types/</link><guid isPermaLink="true">https://leehao.me/posts/web-service-architecture-types/</guid><description>根据 Web 应用架构设计的风格，可以将 Web 服务划分为以功能为中心的服务以及以资源为中心的服务。 以功能为中心的服务 以功能为中心的 Web 服务历史由来已久，它是指能够调用远程机器上的功能或者对象方法，而无须知道这些功能或者对象是如何实现的。 我们了解的 CORBA（公共对象请求代理体...</description><pubDate>Sun, 16 Apr 2017 23:30:49 GMT</pubDate></item><item><title>在阿里云部署 Hexo 网站</title><link>https://leehao.me/posts/deploy-hexo-website-on-aliyun/</link><guid isPermaLink="true">https://leehao.me/posts/deploy-hexo-website-on-aliyun/</guid><description>一开始自己的网站 leehao.me 托管在 GitHub 上面，考虑到 GitHub 的访问可能不稳定，另外，也是抱着学习的目的，就将网站迁移到阿里云上面来了。 网站的总体结构如下图所示： 域名 leehao.me 指向负载均衡 SLB（Server Load Balancer）的 IP，在...</description><pubDate>Sun, 16 Apr 2017 00:06:50 GMT</pubDate></item><item><title>gSOAP 初体验</title><link>https://leehao.me/posts/gsoap-first-experience/</link><guid isPermaLink="true">https://leehao.me/posts/gsoap-first-experience/</guid><description>由于工作调动关系，需要了解 gSOAP 的使用，写个文章记录一下学习的心得，免得以后忘记。 安装 由于本人使用的是 Mac OS 系统，故以 Mac OS 为例说明如何安装 gSOAP。 1）下载 gSOAP 可以在 https://sourceforge.net/projects/gsoap...</description><pubDate>Sat, 15 Apr 2017 00:34:04 GMT</pubDate></item><item><title>Terminal折腾记</title><link>https://leehao.me/posts/terminal-notes/</link><guid isPermaLink="true">https://leehao.me/posts/terminal-notes/</guid><description>闲逛网上文章时，发现可以对Mac的终端进行改造。之前自己一直使用默认的Mac终端 ，并没有过多的配置，使用起来并不是很便捷，这也更加坚定了自己对终端进行改造的决心。 开门见山，先直接上一幅改造后终端的最终效果图： 为了达到上图改造后的效果，需要安装以下几个软件： iTerm2 Z Shell(...</description><pubDate>Tue, 04 Apr 2017 18:41:30 GMT</pubDate></item><item><title>tmux：终端复用利器</title><link>https://leehao.me/posts/tmux-terminal-multiplexer-tool/</link><guid isPermaLink="true">https://leehao.me/posts/tmux-terminal-multiplexer-tool/</guid><description>什么是终端复用（terminal multiplexer）？终端复用可以让你在同一个终端同时打开不同的程序并观察输出，同时允许你方便地退出和恢复这些程序的使用。 使用tmux可以达到终端复用的目的，下图为tmux在同一个终端窗口中同时打开不同程序的一个示例： 安装 对于 Mac OS，使用简单...</description><pubDate>Mon, 03 Apr 2017 13:45:25 GMT</pubDate></item><item><title>博客使用上了网易云跟贴</title><link>https://leehao.me/posts/blog-integrates-netease-cloud-comment/</link><guid isPermaLink="true">https://leehao.me/posts/blog-integrates-netease-cloud-comment/</guid><description>本来对于多说不支持 HTTPS 就不太满意，早就想换一个评论系统了。昨天上去多说的官网一看，发现多说竟然要在今年6月1号关闭了。 可能是多说没有找到赚钱的路子吧，这样的话自己只能默默祝福一下了。 多说的关闭也坚定了自己将博客的评论跟换成网易跟贴的决心。 说干就干。</description><pubDate>Sun, 02 Apr 2017 13:22:53 GMT</pubDate></item><item><title>make命令与makefile文件</title><link>https://leehao.me/posts/make-command-and-makefile/</link><guid isPermaLink="true">https://leehao.me/posts/make-command-and-makefile/</guid><description>一、多个源文件带来的问题 在编写c/c++测试程序时，我们习惯每次修改一处代码，然后就马上编译运行来查看运行的结果。这种编译方式对于小程序来说是没有多大问题的，可对于大型程序来说，由于包含了大量的源文件，如果每次改动一个地方都需要编译所有的源文件，这个简单的直接编译所有源文件方式对程序员来说简...</description><pubDate>Wed, 29 Mar 2017 21:32:05 GMT</pubDate></item><item><title>epoll 水平触发与边缘触发</title><link>https://leehao.me/posts/epoll-level-triggered-and-edge-triggered/</link><guid isPermaLink="true">https://leehao.me/posts/epoll-level-triggered-and-edge-triggered/</guid><description>epoll也是实现I/O多路复用的一种方法，为了深入了解epoll的原理，我们先来看下epoll水平触发（level trigger，LT，LT为epoll的默认工作模式）与边缘触发（edge trigger，ET）两种工作模式。 使用脉冲信号来解释LT和ET可能更加贴切。Level是指信号只...</description><pubDate>Tue, 28 Mar 2017 08:40:15 GMT</pubDate></item><item><title>I/O多路复用之POLL系统调用</title><link>https://leehao.me/posts/io-multiplexing-poll-system-call/</link><guid isPermaLink="true">https://leehao.me/posts/io-multiplexing-poll-system-call/</guid><description>函数类似于函数，也可以实现I/O多路复用。函数的声明如下： 第一个参数是指向一个结构数组第一个元素的指针。每个数组元素都是一个结构，用于指定测试某个给定描述符的条件。 要测试的条件由成员指定，函数在相应的成员中返回该描述符的状态。和都由某个特定条件的一位或多位构成。下面表格列出了用于指定标志以...</description><pubDate>Sun, 26 Mar 2017 13:53:20 GMT</pubDate></item><item><title>I/O多路复用之select系统调用</title><link>https://leehao.me/posts/io-multiplexing-select-system-call/</link><guid isPermaLink="true">https://leehao.me/posts/io-multiplexing-select-system-call/</guid><description>I/O多路复用模型允许我们同时等待多个套接字描述符是否就绪。Linux系统为实现I/O多路复用提供的最常见的一个函数是函数，该函数允许进程指示内核等待多个事件中的任何一个发生，并只有在一个或多个事件发生或经历一段指定的时间后才唤醒它。 作为一个例子，我们可以调用，告知内核仅在下列情况发生时才返...</description><pubDate>Sat, 25 Mar 2017 23:57:24 GMT</pubDate></item><item><title>多线程并发服务器</title><link>https://leehao.me/posts/multi-threaded-concurrent-server/</link><guid isPermaLink="true">https://leehao.me/posts/multi-threaded-concurrent-server/</guid><description>在多进程并发服务器的应用程序中，父进程一个连接，一个子进程，该子进程负责处理与该连接对端的客户之间的通信。 尽管多进程的编程模型中，各进程拥有独立的地址空间，减少了出错的概率，然而，调用却存在一些问题： 是昂贵的，要把父进程的内存映像复制到子进程，并在子进程中复制所有描述符，这个操作是较重量级...</description><pubDate>Sat, 25 Mar 2017 16:02:14 GMT</pubDate></item><item><title>多进程并发服务器</title><link>https://leehao.me/posts/multi-process-concurrent-server/</link><guid isPermaLink="true">https://leehao.me/posts/multi-process-concurrent-server/</guid><description>我们来考虑有多个客户同时连接一个服务器的情况。在前面的TCP套接字编程的例子中，我们已经看到，服务器程序在接受来自客户端的一个新连接时，会创建出一个新的套接字（已连接套接字），而原先的监听套接字则继续监听后面的连接请求。如果服务器不能立刻接受后来的连接，它们将被放到队列中以等待处理。 原先的套...</description><pubDate>Thu, 23 Mar 2017 16:45:37 GMT</pubDate></item><item><title>监听套接字与已连接套接字</title><link>https://leehao.me/posts/listening-socket-vs-connected-socket/</link><guid isPermaLink="true">https://leehao.me/posts/listening-socket-vs-connected-socket/</guid><description>监听套接字（listening socket）和已连接套接字（connected socket）之间的区别常会使很多人感到迷惑。本文简要描述一下这两者的区别。 为了说明监听套接字与已连接套接字的区别，我们先来看一下套接字在连接中的含义。 从内核的角度来看，一个套接字就是通信的一个端点。一个连接...</description><pubDate>Wed, 22 Mar 2017 21:42:32 GMT</pubDate></item><item><title>TCP套接字编程入门</title><link>https://leehao.me/posts/tcp-socket-programming-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/tcp-socket-programming-introduction/</guid><description>概述 套接字（socket）是一种通信机制，凭借这种机制，客户与服务器的通信既可以在本地单机上进行，也可以跨网络进行。 图：基本的TCP客户/服务器应用程序的套接字函数 图中展示了一对TCP客户与服务器进程之间进行通信时调用套接字函数的交互情况。服务器首先启动，然后监听客户的连接。稍后客户试图...</description><pubDate>Tue, 21 Mar 2017 23:48:23 GMT</pubDate></item><item><title>UDP 套接字编程入门</title><link>https://leehao.me/posts/udp-socket-programming-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/udp-socket-programming-introduction/</guid><description>概述 在使用TCP编写的应用程序和使用UDP编写的应用程序之间存在一些本质差异，其原因在于这两个传输层之间的差别：UDP是无连接不可靠的数据报协议，不同于TCP提供的面向连接的可靠字节流。从资源的角度来看，相对来说UDP套接字开销较小，因为不需要维持网络连接，而且因为无需花费时间来连接连接，所...</description><pubDate>Mon, 20 Mar 2017 19:38:40 GMT</pubDate></item><item><title>Windows 编程概述</title><link>https://leehao.me/posts/windows-programming-overview/</link><guid isPermaLink="true">https://leehao.me/posts/windows-programming-overview/</guid><description>本文对windows编程中涉及的一些基本概念作一个简单的概述。 事件驱动 Windows 应用程序基于事件驱动模型，windows应用程序启动后会一直等待事件的发生。 常见的事件包括，键盘某个按键被按下，鼠标单击，窗口按钮被点击，窗口可见，等等。 消息与消息队列 Windows 操作系统使用消...</description><pubDate>Sun, 19 Mar 2017 15:12:44 GMT</pubDate></item><item><title>图解UNIX的I/O模型</title><link>https://leehao.me/posts/illustration-of-unix-io-models/</link><guid isPermaLink="true">https://leehao.me/posts/illustration-of-unix-io-models/</guid><description>一、简述 UNIX系统将所有的外部设备都看作一个文件来看待，所有打开的文件都通过文件描述符来引用。文件描述符是一个非负整数，它指向内核中的一个结构体。当打开一个现有文件或创建一个新文件时，内核向进程返回一个文件描述符。而对于一个socket的读写也会有相应的文件描述符，称为socketfd（s...</description><pubDate>Sun, 12 Mar 2017 08:42:27 GMT</pubDate></item><item><title>Google Protocol Buffers 体验日志</title><link>https://leehao.me/posts/google-protocol-buffers-experience-log/</link><guid isPermaLink="true">https://leehao.me/posts/google-protocol-buffers-experience-log/</guid><description>最近在看RPC的相关的实现，其中google的 gRPC 默认使用 Protocol Buffers 来作为其接口描述语言（IDL，Interface Definition Language）以及使用 Protocol Buffers 实现消息的序列化与反序列化。因此，很有必要对 protoc...</description><pubDate>Sun, 12 Mar 2017 08:16:54 GMT</pubDate></item><item><title>TCP的连接管理</title><link>https://leehao.me/posts/tcp-connection-management/</link><guid isPermaLink="true">https://leehao.me/posts/tcp-connection-management/</guid><description>简述 TCP是面向连接的协议，TCP把连接作为最基本的抽象。每一条TCP连接唯一地被通信两端的两个端点所确定。那么，TCP连接的端点是什么呢？TCP连接的端点又叫套接字（socket），根据TCP协议的规定，端口号拼接到IP地址即构成了套接字，即 &gt; 套接字 socket = （IP地址：端口...</description><pubDate>Sat, 11 Mar 2017 08:23:41 GMT</pubDate></item><item><title>Redis Sentinel 学习笔记</title><link>https://leehao.me/posts/redis-sentinel-learning-notes/</link><guid isPermaLink="true">https://leehao.me/posts/redis-sentinel-learning-notes/</guid><description>概述 Redis Sentinel 是用来实现 Redis 高可用的一套解决方案。Redis Sentinel 由两个部分组成：由一个或者多个 Sentinel 实例组成 Sentinel 系统；由一个主 Redis 服务器（master redis）和多个从 Redis 服务器（slave ...</description><pubDate>Sat, 04 Mar 2017 23:07:28 GMT</pubDate></item><item><title>ZooKeeper的Znode剖析</title><link>https://leehao.me/posts/zookeeper-znode-analysis/</link><guid isPermaLink="true">https://leehao.me/posts/zookeeper-znode-analysis/</guid><description>在ZooKeeper中，节点也称为znode。由于对于程序员来说，对zk的操作主要是对znode的操作，因此，有必要对znode进行深入的了解。 ZooKeeper采用了类似文件系统的的数据模型，其节点构成了一个具有层级关系的树状结构。例如，图1展示了zk节点的层级树状结构。 图1：ZooKe...</description><pubDate>Wed, 22 Feb 2017 08:22:26 GMT</pubDate></item><item><title>ZooKeeper命令简介</title><link>https://leehao.me/posts/zookeeper-commands-introduction/</link><guid isPermaLink="true">https://leehao.me/posts/zookeeper-commands-introduction/</guid><description>ZooKeeper的客户端包括Java版本和C语言版本。使用Java版本连接zk的命令以下： 执行此命令，客户端成功连接上zk，会有类似以下的输出，其中，包括“Welcome to ZooKeeper!”的欢迎语，以及其他一些连接的信息等。 连接成功后，便可以使用命令与zk服务进行交互。</description><pubDate>Wed, 22 Feb 2017 08:12:10 GMT</pubDate></item><item><title>ZooKeeper的安装与部署</title><link>https://leehao.me/posts/zookeeper-installation-and-deployment/</link><guid isPermaLink="true">https://leehao.me/posts/zookeeper-installation-and-deployment/</guid><description>本文讲述如何安装和部署ZooKeeper。 一、系统要求 ZooKeeper可以运行在多种系统平台上面，表1展示了zk支持的系统平台，以及在该平台上是否支持开发环境或者生产环境。 表1：ZooKeeper支持的运行平台 系统  生产环境 ----------------Linux  支持 So...</description><pubDate>Wed, 22 Feb 2017 07:29:17 GMT</pubDate></item><item><title>ZooKeeper概览</title><link>https://leehao.me/posts/zookeeper-overview/</link><guid isPermaLink="true">https://leehao.me/posts/zookeeper-overview/</guid><description>一、简介 ZooKeeper是一个高性能，分布式的，开源分布式应用协调服务。它提供了简单原始的功能，分布式应用可以基于它实现更高级的服务，比如同步，集群管理，命名空间，配置维护等。ZooKeeper使用了我们熟悉的文件树状结构作为自己的数据模型，因此是易于使用的。 我们知道，由于资源竞争等因素...</description><pubDate>Wed, 22 Feb 2017 07:25:19 GMT</pubDate></item><item><title>如何理解Nginx, WSGI, Flask之间的关系</title><link>https://leehao.me/posts/how-to-understand-nginx-wsgi-flask-relationship/</link><guid isPermaLink="true">https://leehao.me/posts/how-to-understand-nginx-wsgi-flask-relationship/</guid><description>概览 之前对 Nginx，WSGI（或者 uWSGI，uwsgi），Flask(或者 Django），这几者的关系一存存在疑惑。通过查阅了些资料，总算把它们的关系理清了。 总括来说，客户端从发送一个 HTTP 请求到 Flask 处理请求，分别经过了 web服务器层，WSGI层，web框架层，...</description><pubDate>Wed, 22 Feb 2017 07:16:14 GMT</pubDate></item><item><title>RPC 基本原理与 Apach Thrift 初体验</title><link>https://leehao.me/posts/rpc-basic-principles-and-apache-thrift-first-experience/</link><guid isPermaLink="true">https://leehao.me/posts/rpc-basic-principles-and-apache-thrift-first-experience/</guid><description>概述 RPC（Remote Procedure Call，远程过程调用）是一个计算机通信协议，此协议允许进程间通信。简单来说，当机器 A 上的进程调用机器 B 上的进程时，A 上的调用进程被挂起，而 B 上的被调用进程开始执行。调用方可以通过参数将信息传送给被调用方，然后可以通过被调用方传回的...</description><pubDate>Tue, 14 Feb 2017 23:06:59 GMT</pubDate></item><item><title>细说 C++ Traits Classes</title><link>https://leehao.me/posts/c-plus-plus-traits-classes/</link><guid isPermaLink="true">https://leehao.me/posts/c-plus-plus-traits-classes/</guid><description>最近在看侯捷的《STL源码剖析》，看到第三章有关 traits 的介绍，被搞得一头雾水，看了半天不知所云。为了彻底了解这个技法的原理，硬着头皮上网查了资料，并结合 Scott Meyers 的 《Effective C++》，总算是把 traits 的原理搞明白了:) 什么是 traits？我...</description><pubDate>Tue, 14 Feb 2017 21:01:58 GMT</pubDate></item><item><title>体验 gRPC 那些事儿</title><link>https://leehao.me/posts/experience-with-grpc/</link><guid isPermaLink="true">https://leehao.me/posts/experience-with-grpc/</guid><description>概述 我们来看 google 对于 gRPC 的定义： &gt; A high performance, open-source universal RPC framework 即 gRPC 是一个开源的高性能通过 RPC 框架。具体来说，它具有以下特点： 使用 protocol buffers 来...</description><pubDate>Tue, 31 Jan 2017 22:48:43 GMT</pubDate></item><item><title>Git远程仓库</title><link>https://leehao.me/posts/git-remote-repository/</link><guid isPermaLink="true">https://leehao.me/posts/git-remote-repository/</guid><description>Git 支持在本地仓库进行程序项目的版本管理，这个本地的 git 仓库在程序项目的文件夹内（也就是 “.git” 文件夹内）。随着程序项目的推进，我们会把不同阶段的文件内容加入到这个 git 仓库中。这个仓库由我们直接操控，我们将它称之为“本地 git 仓库”。 除了“本地 git 仓库”外，...</description><pubDate>Tue, 31 Jan 2017 08:42:06 GMT</pubDate></item><item><title>MongoDB Java使用指南</title><link>https://leehao.me/posts/mongodb-java-usage-guide/</link><guid isPermaLink="true">https://leehao.me/posts/mongodb-java-usage-guide/</guid><description>MongoDB是当今非常流行的一款NoSQL数据库，本文介绍如何使用MongoDB的Java驱动来操作MongoDB。 一、引入MongoDB Java Driver包 如果需要操作MongoDB的Java项目是一个Maven项目，可以在依赖中加上以下的配置。 或者通过直接下载jar包的方式使...</description><pubDate>Thu, 26 Jan 2017 07:26:24 GMT</pubDate></item><item><title>Python Requests库简明使用教程</title><link>https://leehao.me/posts/python-requests-library-tutorial/</link><guid isPermaLink="true">https://leehao.me/posts/python-requests-library-tutorial/</guid><description>Requests是一常用的http请求库，它使用python语言编写，可以方便地发送http请求，以及方便地处理响应结果。 一、安装 1.1 使用pip进行安装 要安装requests，最方便快捷的方法是使用pip进行安装。 &gt; pip install requests 如果还没有安装pip，...</description><pubDate>Tue, 24 Jan 2017 20:11:39 GMT</pubDate></item><item><title>负载均衡（Load Balancing）学习笔记三——负载均衡算法</title><link>https://leehao.me/posts/load-balancing-algorithms/</link><guid isPermaLink="true">https://leehao.me/posts/load-balancing-algorithms/</guid><description>本文讲述实现负载均衡的常用算法。 轮询法（Round Robin） 轮询法是负载均衡中最常用的算法，它容易理解也容易实现。 轮询法是指负载均衡服务器（load balancer）将客户端请求按顺序轮流分配到后端服务器上，以达到负载均衡的目的。 假设现在有6个客户端请求，2台后端服务器。当第一个...</description><pubDate>Tue, 24 Jan 2017 16:47:43 GMT</pubDate></item><item><title>负载均衡（Load Balancing）学习笔记(二)</title><link>https://leehao.me/posts/load-balancing-study-notes-part-2/</link><guid isPermaLink="true">https://leehao.me/posts/load-balancing-study-notes-part-2/</guid><description>概述 文章负载均衡（Load Balancing）学习笔记(一)  讲述了负载均衡的一般性原理，本文继续介绍常见的实现负载均衡的方法。 HTTP重定向 HTTP重定向服务器是一台普通的Web服务器，用户的请求先到达重定向服务器，这台服务器会挑选一台后端服务器的地址（例如使用轮询的方式），并将该...</description><pubDate>Tue, 24 Jan 2017 16:43:54 GMT</pubDate></item><item><title>使用Redis SETNX 命令实现分布式锁</title><link>https://leehao.me/posts/using-redis-setnx-to-implement-distributed-lock/</link><guid isPermaLink="true">https://leehao.me/posts/using-redis-setnx-to-implement-distributed-lock/</guid><description>使用Redis的 SETNX 命令可以实现分布式锁，下文介绍其实现方法。 SETNX命令简介 命令格式 &gt; SETNX key value 将 key 的值设为 value，当且仅当 key 不存在。 若给定的 key 已经存在，则 SETNX 不做任何动作。 SETNX 是SET if No...</description><pubDate>Tue, 24 Jan 2017 16:21:01 GMT</pubDate></item><item><title>C++虚函数表剖析</title><link>https://leehao.me/posts/cpp-virtual-function-table-analysis/</link><guid isPermaLink="true">https://leehao.me/posts/cpp-virtual-function-table-analysis/</guid><description>关键词：虚函数，虚表，虚表指针，动态绑定，多态 一、概述 为了实现 C+的多态，C+使用了一种动态绑定的技术。这个技术的核心是虚函数表（下文简称虚表）。本文介绍虚函数表是如何实现动态绑定的。 二、类的虚表 每个包含了虚函数的类都包含一个虚表。 我们知道，当一个类（A）继承另一个类（B）时，类 ...</description><pubDate>Tue, 24 Jan 2017 15:23:08 GMT</pubDate></item><item><title>负载均衡（Load Balancing）学习笔记(一)</title><link>https://leehao.me/posts/load-balancing-study-notes-part-1/</link><guid isPermaLink="true">https://leehao.me/posts/load-balancing-study-notes-part-1/</guid><description>概述 在分布式系统中，负载均衡（Load Balancing）是一种将任务分派到多个服务端进程的方法。例如，将一个HTTP请求派发到实际的Web服务器中执行的过程就涉及负载均衡的实现。一个HTTP请求到达Web服务器，这中间涉及多个过程，也存在多种不同负载均衡的方法。本文讲述负载均衡的基本原理...</description><pubDate>Tue, 24 Jan 2017 15:05:18 GMT</pubDate></item><item><title>一致性Hash(Consistent Hashing)原理剖析</title><link>https://leehao.me/posts/consistent-hashing-principle-analysis/</link><guid isPermaLink="true">https://leehao.me/posts/consistent-hashing-principle-analysis/</guid><description>引入 在业务开发中，我们常把数据持久化到数据库中。如果需要读取这些数据，除了直接从数据库中读取外，为了减轻数据库的访问压力以及提高访问速度，我们更多地引入缓存来对数据进行存取。读取数据的过程一般为： 图1：加入缓存的数据读取过程 对于分布式缓存，不同机器上存储不同对象的数据。为了实现这些缓存机...</description><pubDate>Tue, 24 Jan 2017 14:38:46 GMT</pubDate></item></channel></rss>