<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>数据库与存储 on Two Tigers Engineering</title>
    <link>https://blog.twotigers.xyz/categories/%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%8E%E5%AD%98%E5%82%A8/</link>
    <description>Recent content in 数据库与存储 on Two Tigers Engineering</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 01 Jan 2024 15:23:08 +0800</lastBuildDate><atom:link href="https://blog.twotigers.xyz/categories/%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%8E%E5%AD%98%E5%82%A8/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>使用 docker 部署 kafka</title>
      <link>https://blog.twotigers.xyz/posts/kafka/</link>
      <pubDate>Mon, 01 Jan 2024 15:23:08 +0800</pubDate>
      
      <guid>https://blog.twotigers.xyz/posts/kafka/</guid>
      <description>在很多时候我们需要使用到消息队列, 其中 kafka 是一个非常优秀的消息队列, 在我们平时开发中也经常会用到, 但是在开发环境中部署 kafka 是一个非常麻烦的事情
在 kafka 官网上, 有一个详细的部署文档, 需要的小伙伴可以参考这个文档 https://kafka.apache.org/quickstart, 但是随之带来的问题是, 我们需要 java 环境, 并且需要安装 zookerper,
那么如果我仅仅是想本地开发环境中使用 kafka, 有没有更简单的方法呢? 为了解决这个问题, 我们可以使用 docker 来部署 kafka
使用 docker 来部署 kafka 的测试节点, 我们需要先安装 docker 和 docker-compose, 这里就不再赘述了, 请自行安装
首先我们在已经安装好 docker 和 docker-compose 的机器上, 创建一个目录, 并且在这个目录下创建一个 docker-compose.yml 文件, 文件内容如下
version: &amp;#34;2&amp;#34; services: kafka: image: docker.io/bitnami/kafka:3.6 ports: - &amp;#39;9094:9094&amp;#39; volumes: - &amp;#34;kafka_data:/bitnami&amp;#34; environment: # KRaft settings - KAFKA_CFG_NODE_ID=0 - KAFKA_CFG_PROCESS_ROLES=controller,broker - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 # Listeners - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094 - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://localhost:9094 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT volumes: kafka_data: driver: local 然后我们就可以在这个目录下执行 docker-compose up -d 来启动 kafka 了, 启动完成后, 我们可以使用 docker ps 命令来查看 kafka 是否启动成功</description>
    </item>
    
    <item>
      <title>数据库跟 null 比较会得到非预期结果</title>
      <link>https://blog.twotigers.xyz/posts/database/operator/</link>
      <pubDate>Wed, 13 Oct 2021 16:00:08 +0800</pubDate>
      
      <guid>https://blog.twotigers.xyz/posts/database/operator/</guid>
      <description>现象 在执行 sql 中得到了非预期结果
select * from user where age &amp;gt; 20; 其中, 数据库中存在大量的 age 为 null 的记录, 在执行完上述 sql 后, 没有将 age is null 的数据查出
测试 SELECT 1&amp;gt;=1, NULL = NULL, Null &amp;gt; 1; mysql 5.7.21-log sqlite 3.34.0 postgresql PostgreSQL 14.0 (Debian 14.0-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit 原因 stackoverflow
在 The Three-Valued Logic of SQL 中规定, 与 null 比较返回值为 null
The SQL null value basically means “could be anything”.</description>
    </item>
    
    <item>
      <title>alpine docker container 中安装 mysql client</title>
      <link>https://blog.twotigers.xyz/posts/database/docker/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://blog.twotigers.xyz/posts/database/docker/</guid>
      <description>apk add mysql mysql-client </description>
    </item>
    
  </channel>
</rss>
