<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"><channel><title>qiaoqiao</title><link>https://blog.iffi.top/</link><atom:link href="https://blog.iffi.top/feed.xml" rel="self" type="application/rss+xml"/><description>我会把白云摘下，塞进你的口袋里</description><generator>Halo v2.21.3</generator><language>zh-cn</language><image><url>https://blog.iffi.top/upload/blog2.ico</url><title>qiaoqiao</title><link>https://blog.iffi.top/</link></image><lastBuildDate>Mon, 13 Apr 2026 14:27:05 GMT</lastBuildDate><item><title><![CDATA[outlook打开邮件报错Contacting the Server for Information]]></title><link>https://blog.iffi.top/archives/outlookda-kai-you-jian-bao-cuo-contacting-the-server-for-information</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=outlook%E6%89%93%E5%BC%80%E9%82%AE%E4%BB%B6%E6%8A%A5%E9%94%99Contacting%20the%20Server%20for%20Information&amp;url=/archives/outlookda-kai-you-jian-bao-cuo-contacting-the-server-for-information" width="1" height="1" alt="" style="opacity:0;">
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F201.1.png&amp;size=m" alt="201.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">解决办法：检查邮件正文里是否有包含链接的图片，且该图片显示异常，删除该异常图片。</p>]]></description><guid isPermaLink="false">/archives/outlookda-kai-you-jian-bao-cuo-contacting-the-server-for-information</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Foutlook.png&amp;size=m" type="image/jpeg" length="129695"/><category>windows</category><pubDate>Thu, 13 Nov 2025 02:34:31 GMT</pubDate></item><item><title><![CDATA[将数据同步到云盘：openlist+rclone]]></title><link>https://blog.iffi.top/archives/Synchronize-the-data-to-the-cloud-disk%20%3Aopenlist%2Brclone</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E5%B0%86%E6%95%B0%E6%8D%AE%E5%90%8C%E6%AD%A5%E5%88%B0%E4%BA%91%E7%9B%98%EF%BC%9Aopenlist%2Brclone&amp;url=/archives/Synchronize-the-data-to-the-cloud-disk%20%3Aopenlist%2Brclone" width="1" height="1" alt="" style="opacity:0;">
<p style="">为了保险起见，最好同步一份数据到云盘，这样本地硬盘挂了，至少还有云端的一份。同步方式是用openlist+rclone，云盘的话阿里云盘，天翼云盘等等只要可以被openlist挂载的都可以。当然cloudflare的对象存储也可以，但我担心会超额度，还是用云盘更保险。</p>
<h2 style="" id="%E5%AE%9E%E4%BE%8B1%EF%BC%9A%E5%A4%87%E4%BB%BDmysql%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93"><strong>实例1：备份mysql的数据库</strong></h2>
<p style="">这个操作可以用任意一台机器，首先需要安装mysqldump</p>
<h3 style="" id="%E5%AE%89%E8%A3%85mysqldump"><strong>安装mysqldump</strong></h3>
<pre><code>sudo apt install mysql-client     //ubuntu系统
</code></pre>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E8%84%9A%E6%9C%AC"><strong>创建脚本</strong></h3>
<p style="">备份单个数据库</p>
<pre><code>#!/bin/bash

# 数据库信息配置
DB_USER="user"          # 数据库用户名
DB_PASSWORD="123456"    # 数据库密码
DB_NAME="name"         # 数据库名称
DB_HOST="ip"
DB_PORT="3306"
# 备份保存路径
BACKUP_DIR="/backup/mysql"
DATE=$(date +%F)
FILENAME="${DB_NAME}_${DATE}.sql"
TARFILE="${FILENAME}.tar.gz"
# 创建备份目录（如果不存在）
mkdir -p "$BACKUP_DIR"
# 开始备份
echo "[$(date)] 开始备份数据库 $DB_NAME ..."
mysqldump -h ${DB_HOST} -u$DB_USER -p$DB_PASSWORD -P${DB_PORT} $DB_NAME &gt; "$BACKUP_DIR/$FILENAME"
# 压缩备份
tar -czf "$BACKUP_DIR/$TARFILE" -C "$BACKUP_DIR" "$FILENAME"
rm "$BACKUP_DIR/$FILENAME"
echo "[$(date)] 备份完成：$TARFILE"
# 自动删除7天前的旧备份
find "$BACKUP_DIR" -name "${DB_NAME}_*.tar.gz" -mtime +7 -exec rm {} \;
echo "[$(date)] 清理7天前备份完成"
</code></pre>
<p style="">备份多个数据库</p>
<pre><code>#!/bin/bash
# mysql_multi_backup.sh

# 配置
MYSQL_USER="user"
MYSQL_PASSWORD="123456"
MYSQL_HOST="ip"
MYSQL_PORT="3306"
BACKUP_DIR="/backup/mysql"
DATE=$(date +%Y%m%d)

# 要备份的数据库列表
DATABASES=("db1" "db2" "db3")

# 创建备份目录
mkdir -p $BACKUP_DIR

echo "开始MySQL备份 - $(date)"

# 备份每个数据库
for DB in "${DATABASES[@]}"; do
    BACKUP_FILE="$BACKUP_DIR/${DB}_${DATE}.sql.gz"
    echo "备份数据库: $DB"
    
    mysqldump -h $MYSQL_HOST -P$MYSQL_PORT -u $MYSQL_USER -p$MYSQL_PASSWORD $DB | gzip &gt; $BACKUP_FILE
    
    if [ $? -eq 0 ]; then
        echo "✓ $DB 备份成功"
    else
        echo "✗ $DB 备份失败"
    fi
done

# 清理旧备份（保留7天）
find $BACKUP_DIR -name "*.sql.gz" -mtime +7 -delete

echo "所有数据库备份完成 - $(date)"
</code></pre>
<p style="">添加执行权限</p>
<pre><code>chmod +x /backup/mysql_backup.sh
</code></pre>
<h3 style="" id="%E8%AE%BE%E7%BD%AE%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1"><strong>设置定时任务</strong></h3>
<pre><code>crontab -e
</code></pre>
<pre><code>0 2 * * * /backup/mysql_backup.sh   //每天2点执行
</code></pre>
<h3 style="" id="rclone%E9%85%8D%E7%BD%AE"><strong>rclone配置</strong></h3>
<p style="">安装rclone</p>
<pre><code>sudo apt install rclone   //ubuntu系统
</code></pre>
<p style="">运行配置命令</p>
<pre><code>rclone config
</code></pre>
<p style="">按着提示一步步操作即可
 <br>
 列出 WebDAV 根目录</p>
<pre><code>rclone lsd my_webdav:
</code></pre>
<p style="">同步 同步是保持两端一致，如果目的路径有其他文件，会被删除掉。</p>
<pre><code>rclone sync /backup/mysql openlist:aliyun/backup/mysql     //name是openlist，aliyun/backup/mysql是同步目的的路径
</code></pre>
<p style="">备份</p>
<pre><code>rclone copy /backup/mysql openlist:aliyun/backup/mysql
</code></pre>
<p style="">同样的做个定时任务。</p>
<h2 style="" id="%E5%AE%9E%E4%BE%8B2%EF%BC%9A%E5%A4%87%E4%BB%BDpostgresql%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93"><strong>实例2：备份postgresql的数据库</strong></h2>
<h3 style="" id="%E5%AE%89%E8%A3%85pg_dump"><strong>安装pg_dump</strong></h3>
<pre><code>sudo apt-get install postgresql-client     //ubuntu系统
</code></pre>
<p style="">查看路径</p>
<pre><code>which pg_dump
</code></pre>
<p style="">报错</p>
<pre><code>pg_dump: error: aborting because of server version mismatch
</code></pre>
<p style="">因为版本不匹配</p>
<p style="">升级pg_dump</p>
<pre><code>1.添加官方存储库
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" &gt; /etc/apt/sources.list.d/pgdg.list'
2.导入存储库的 GPG 密钥
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3.更新包列表
4.升级
sudo apt-get install postgresql-client-17
</code></pre>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E8%84%9A%E6%9C%AC-1"><strong>创建脚本</strong></h3>
<p style="">备份单个数据库</p>
<pre><code>#!/bin/bash
# postgres_simple_backup.sh

# 基本配置
PG_HOST="ip"
PG_PORT="5432"
PG_USER="user"
PG_PASSWORD="123456"
DB_NAME="dbname"
BACKUP_DIR="/backup/postgres"

# 创建备份目录
mkdir -p $BACKUP_DIR

# 设置密码
export PGPASSWORD=$PG_PASSWORD

# 执行备份（每天一个文件）
BACKUP_FILE="$BACKUP_DIR/${DB_NAME}_$(date +%Y%m%d).sql.gz"

echo "开始备份数据库: $DB_NAME - $(date)"

# 备份并压缩
pg_dump -h $PG_HOST -p $PG_PORT -U $PG_USER $DB_NAME | gzip &gt; $BACKUP_FILE

if [ $? -eq 0 ]; then
    echo "✓ 备份成功: $BACKUP_FILE"
else
    echo "✗ 备份失败"
fi

# 清理7天前的备份
find $BACKUP_DIR -name "*.sql.gz" -mtime +7 -delete

echo "备份完成 - $(date)"

# 清理密码
unset PGPASSWORD
</code></pre>
<p style="">备份多个数据库</p>
<pre><code>#!/bin/bash
# postgres_multi_backup.sh

# 配置
PG_HOST="ip"
PG_PORT="5432"
PG_USER="user"
PG_PASSWORD="123456"
BACKUP_DIR="/backup/postgres"
DATE=$(date +%Y%m%d)

# 要备份的数据库列表
DATABASES=("umami" "mydb")

# 设置密码
export PGPASSWORD=$PG_PASSWORD

# 创建备份目录
mkdir -p $BACKUP_DIR

echo "开始PostgreSQL备份 - $(date)"

# 备份每个数据库
for DB in "${DATABASES[@]}"; do
    BACKUP_FILE="$BACKUP_DIR/${DB}_${DATE}.sql.gz"
    echo "备份数据库: $DB"
    
    pg_dump -h $PG_HOST -p $PG_PORT -U $PG_USER $DB | gzip &gt; $BACKUP_FILE
    
    if [ $? -eq 0 ]; then
        echo "✓ $DB 备份成功"
    else
        echo "✗ $DB 备份失败"
    fi
done

# 清理旧备份（保留7天）
find $BACKUP_DIR -name "*.sql.gz" -mtime +7 -delete

echo "所有数据库备份完成 - $(date)"

unset PGPASSWORD
</code></pre>
<p style="">其余与上面一致，当执行脚本的时候报错：postgres.sh: 13: Syntax error: "(" unexpected
 <br>
 执行脚本时将sh postgresql.sh改成bash postgresql.sh</p>]]></description><guid isPermaLink="false">/archives/Synchronize-the-data-to-the-cloud-disk%20%3Aopenlist%2Brclone</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Frclone.png&amp;size=m" type="image/jpeg" length="42672"/><category>linux</category><pubDate>Mon, 10 Nov 2025 01:09:05 GMT</pubDate></item><item><title><![CDATA[数据库同步工具 DBSwitch vs dbsyncer]]></title><link>https://blog.iffi.top/archives/Database-synchronization-tool-dbswitch-vs-dbsyncer</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%8C%E6%AD%A5%E5%B7%A5%E5%85%B7%20DBSwitch%20vs%20dbsyncer&amp;url=/archives/Database-synchronization-tool-dbswitch-vs-dbsyncer" width="1" height="1" alt="" style="opacity:0;">
<p style="">我找了两款数据库迁移同步工具，功能类似,都支持不同的数据库之间的数据同步。</p>
<h2 style="" id="dbswitch"><strong>dbswitch</strong></h2>
<h3 style="" id="%E5%AE%89%E8%A3%85"><strong>安装</strong></h3>
<p style="">用的非官方的镜像</p>
<pre><code>docker run -d --name dbswitch  -e DBTYPE=h2  -v /tmp:/tmp  -p 9088:9088 \
  registry.cn-hangzhou.aliyuncs.com/inrgihc/dbswitch:2.0.0
</code></pre>
<p style="">初始账号密码 admin/123456</p>
<h3 style="" id="%E6%B7%BB%E5%8A%A0%E6%95%B0%E6%8D%AE%E6%BA%90"><strong>添加数据源</strong></h3>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.1.png&amp;size=m" alt="199.1.png" width="100%" height="100%" style="display: inline-block"></p>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1"><strong>创建任务</strong></h3>
<p style="">手动调度是指手动执行，系统调度是自动执行</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.2.png&amp;size=m" alt="199.2.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.3.png&amp;size=m" alt="199.3.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.4.png&amp;size=m" alt="199.4.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">如果不添加映射就是按照原表来</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.5.png&amp;size=m" alt="199.5.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.6.gif&amp;size=m" alt="199.6.gif" width="100%" height="100%" style="display: inline-block"></p>
<h2 style="" id="dbsyncer"><strong>dbsyncer</strong></h2>
<h3 style="" id="%E5%AE%89%E8%A3%85-1"><strong>安装</strong></h3>
<pre><code>docker run -d  --name dbsyncer  -p 18686:18686  -e TZ=Asia/Shanghai  crazylife/dbsyncer-web:latest
</code></pre>
<p style="">默认账号密码都是admin</p>
<h3 style="" id="%E6%B7%BB%E5%8A%A0%E6%95%B0%E6%8D%AE%E6%BA%90-1"><strong>添加数据源</strong></h3>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.7.png&amp;size=m" alt="199.7.png" width="100%" height="100%" style="display: inline-block"></p>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1-1"><strong>创建任务</strong></h3>
<p style="">这里的创建任务是点击添加驱动</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.8.png&amp;size=m" alt="199.8.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">添加映射关系</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.9.gif&amp;size=m" alt="199.9.gif" width="100%" height="100%" style="display: inline-block"></p>
<p style="">点击启动</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.10.png&amp;size=m" alt="199.10.png" width="100%" height="100%" style="display: inline-block"></p>
<h2 style="" id="dbsyncer-1"><strong>总结</strong></h2>
<p style="">两个软件功能类似，还都很容易上手，只是有一个问题，dbsyncer的占用特别高，我很不理解，没有执行任务也高。综合来看，我更倾向用dbswitch，毕竟在功能上，还能支持在线运行sql，查看元数据，数据源也支持的更多。</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F199.11.png&amp;size=m" alt="199.11.png" width="100%" height="100%" style="display: inline-block"></p>]]></description><guid isPermaLink="false">/archives/Database-synchronization-tool-dbswitch-vs-dbsyncer</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fdatabase.jpg&amp;size=m" type="image/jpeg" length="27637"/><category>容器</category><pubDate>Fri, 7 Nov 2025 03:01:42 GMT</pubDate></item><item><title><![CDATA[记录下关于数据库的一些常用命令]]></title><link>https://blog.iffi.top/archives/ji-lu-xia-guan-yu-shu-ju-ku-de-yi-xie-chang-yong-ming-ling</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E8%AE%B0%E5%BD%95%E4%B8%8B%E5%85%B3%E4%BA%8E%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E4%B8%80%E4%BA%9B%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4&amp;url=/archives/ji-lu-xia-guan-yu-shu-ju-ku-de-yi-xie-chang-yong-ming-ling" width="1" height="1" alt="" style="opacity:0;">
<p style="">我比较熟悉的是mysql，但最近也开始接触起了postgresql，因为一些docker应用数据库用的是posgresql，当然我不是干DBA的，最多用到的还是基础命令，这里做个记录，以防老年痴呆忘了。。。</p>
<h2 style="" id="mysql"><strong>mysql</strong></h2>
<h3 style="" id="%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F%E5%8C%96"><strong>日期格式化</strong></h3>
<pre><code>SELECT DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s');
</code></pre>
<p style="">%Y：四位数年份</p>
<p style="">%m：两位数月份</p>
<p style="">%d：两位数日</p>
<p style="">%H：小时（24小时制）</p>
<p style="">%i：分钟</p>
<p style="">%s：秒</p>
<h3 style="" id="%E6%95%B0%E5%AD%97%E6%A0%BC%E5%BC%8F%E5%8C%96"><strong>数字格式化</strong></h3>
<h4 style="" id="1.%E4%BF%9D%E7%95%99%E5%B0%8F%E6%95%B0%E7%82%B9"><strong>1.保留小数点</strong></h4>
<pre><code>SELECT ROUND(123.4567, 2);
</code></pre>
<p style="">保留两位小数</p>
<h4 style="" id="2.%E7%99%BE%E5%88%86%E6%AF%94"><strong>2.百分比</strong></h4>
<pre><code>concat(round(min/sum*100,2),"%")
</code></pre>
<h3 style="" id="null%E5%80%BC%E5%81%9A%E5%8A%A0%E5%87%8F%E4%B9%98%E9%99%A4%E6%97%B6%E5%A4%84%E7%90%86"><strong>null值做加减乘除时处理</strong></h3>
<p style="">当对 NULL 值进行相加操作时，结果将始终是 NULL
 <br>
 处理方法：</p>
<pre><code>COALESCE(salary, 0)
</code></pre>
<h3 style="" id="%E5%AD%90%E6%9F%A5%E8%AF%A2%2B%E5%A4%9A%E8%A1%A8%E6%9F%A5%E8%AF%A2"><strong>子查询+多表查询</strong></h3>
<pre><code>select A.class A.sum, B.sum
from
(select class, count(1) as sum from (SUB_QUERY) S group by class) A
left join
(select class, count(1) as sum from (SUB_QUERY) S where S.score &gt;= 60 group by class) B
on A.class = B.class
</code></pre>
<h3 style="" id="%E5%A4%87%E4%BB%BD"><strong>备份</strong></h3>
<pre><code>mysqldump -uroot -p123456  database_name &gt; database_backup.sql
mysqldump -h ip -P3306 -uroot -p123456  database_name &gt; database_backup.sql    //备份远程数据库
</code></pre>
<h3 style="" id="%E6%81%A2%E5%A4%8D"><strong>恢复</strong></h3>
<pre><code>mysql -uroot -p123456 database_name &lt; database_backup.sql
mysql -h ip -P3306 -uroot -p123456  database_name &lt; database_backup.sql   //恢复远程数据库
</code></pre>
<h2 style="" id="postgresql"><strong>postgresql</strong></h2>
<h3 style="" id="%E5%A4%87%E4%BB%BD-1"><strong>备份</strong></h3>
<pre><code>pg_dump -U postgres -d database_name &gt; database_name.sql     //备份为纯sql脚本
pg_dump -U postgres -d database_name -Fc &gt; database_name.dump  //备份为自定义压缩格式，体积更小，推荐用这种方式
pg_dump -h ip -p 5432 -U postgres -d database_name &gt; database_name.sql    //备份远程数据库
</code></pre>
<h3 style="" id="">恢复</h3>
<pre><code>psql -U username -d database_name &lt; backup.sql      //恢复纯sql脚本的备份
pg_restore -h ip -U postgres -d database_name  database_name.dump   //恢复pg_dump的备份 
</code></pre>
<h3 style="" id="%E8%BF%9E%E6%8E%A5%E8%BF%9C%E7%A8%8B%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93"><strong>连接远程的数据库</strong></h3>
<pre><code>psql -h ip -p 5432 -U root -d postgres   //连接到默认的postgres数据库
</code></pre>
<h3 style="" id="%E6%9F%A5%E7%9C%8B%E6%89%80%E6%9C%89%E6%95%B0%E6%8D%AE%E5%BA%93"><strong>查看所有数据库</strong></h3>
<pre><code>\l
</code></pre>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E6%95%B0%E6%8D%AE%E5%BA%93"><strong>创建数据库</strong></h3>
<pre><code>createdb -h ip -U postgres mydatabase
</code></pre>
<h3 style="" id="%E5%88%A0%E9%99%A4%E6%95%B0%E6%8D%AE%E5%BA%93"><strong>删除数据库</strong></h3>
<pre><code>dropdb -h ip -U postgres mydatabase
</code></pre>
<h3 style="" id="%E9%87%8D%E7%BD%AEid"><strong>重置id</strong></h3>
<p style="">重置自增计数器</p>
<pre><code>ALTER SEQUENCE students_id_seq RESTART WITH 1;
</code></pre>
<p style="">将students表的id字段重置为从1开始自增</p>
<h3 style="" id="null%E5%80%BC%E5%A4%84%E7%90%86"><strong>null值处理</strong></h3>
<p style="">将null值转为0</p>
<pre><code>COALESCE(column2, 0)
</code></pre>
<h3 style="" id="%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F%E5%8C%96-1"><strong>日期格式化</strong></h3>
<pre><code>TO_CHAR(riqi,'YYYY-MM')
</code></pre>
<h3 style="" id="%E8%BF%9E%E6%8E%A5%E5%A4%9A%E4%B8%AA%E5%AD%97%E7%AC%A6%E4%B8%B2"><strong>连接多个字符串</strong></h3>
<pre><code>CONCAT(Hello, World)   //结果是Hello World
</code></pre>
<h3 style="" id="%E6%95%B0%E5%AD%97%E4%BF%9D%E7%95%99%E5%B0%8F%E6%95%B0%E7%82%B9"><strong>数字保留小数点</strong></h3>
<pre><code>ROUND(sum(money) ::numeric,2)    //保留2位小数</code></pre>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/ji-lu-xia-guan-yu-shu-ju-ku-de-yi-xie-chang-yong-ming-ling</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fdatabase.jpg&amp;size=m" type="image/jpeg" length="27637"/><category>其他</category><pubDate>Thu, 6 Nov 2025 01:59:27 GMT</pubDate></item><item><title><![CDATA[导出AD域环境下特定组成员]]></title><link>https://blog.iffi.top/archives/Export-members-of-a-specific-group-in-an-AD-domain-environment</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E5%AF%BC%E5%87%BAAD%E5%9F%9F%E7%8E%AF%E5%A2%83%E4%B8%8B%E7%89%B9%E5%AE%9A%E7%BB%84%E6%88%90%E5%91%98&amp;url=/archives/Export-members-of-a-specific-group-in-an-AD-domain-environment" width="1" height="1" alt="" style="opacity:0;">
<p style="">#导出域环境下特定组成员
 <br>
 将域环境下组成员导出到文件
 <br>
 在域服务器下打开powershell
 <br>
 输入</p>
<pre><code>Get-ADGroupMember -Identity "GroupName" | Export-CSV -Path "C:\GroupMembers.csv" 
</code></pre>
<p style="">内容有些多，做下筛选</p>
<pre><code>Get-ADGroupMember -Identity "GroupName"  | select Name,SamAccountName | Export-CSV -Path "C:\GroupMembers.csv"
</code></pre>
<p style="">按指定OU导出所有用户</p>
<pre><code>Get-ADUser -Filter * -SearchBase "OU=Users,OU=zigongsi,OU=Users,DC=gongsi,DC=com"  | Export-CSV -Path "C:\GroupMembers.csv"
</code></pre>
<p style="">OU其实挺抽象，这里用一个简单的方式表达</p>
<pre><code>gongsi.com    //这是域名  
   Users      //这是一级OU  
      zigongsi    //二级OU  
         users    //这个三级OU下是用户</code></pre>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/Export-members-of-a-specific-group-in-an-AD-domain-environment</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2FAD.png&amp;size=m" type="image/jpeg" length="23271"/><category>windows</category><pubDate>Wed, 5 Nov 2025 08:37:47 GMT</pubDate></item><item><title><![CDATA[记账后续]]></title><link>https://blog.iffi.top/archives/ji-zhang-hou-xu</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E8%AE%B0%E8%B4%A6%E5%90%8E%E7%BB%AD&amp;url=/archives/ji-zhang-hou-xu" width="1" height="1" alt="" style="opacity:0;">
<p style="">虽然看似瞎折腾了很久，但其实没啥用。我还是认为简道云是目前记账最好的解决方案，但是我又希望数据能存在本地，手搓前端和后端我没这个能力，于是我寻找了下可私有化的低代码平台，然后用了nocobase这个项目，类似的项目还有很多，有跟简道云一样拖拽式的，但没必要都试，主要太费时间。以下是我做的一些尝试。</p>
<h2 style="" id="%E5%AE%89%E8%A3%85"><strong>安装</strong></h2>
<p style="">docker-compose安装</p>
<pre><code>version: '3'

networks:
  nocobase:
    driver: bridge

services:
  app:
    image: registry.cn-shanghai.aliyuncs.com/nocobase/nocobase:latest-full
    restart: always
    networks:
      - nocobase
    depends_on:
      - mysql
    environment:
      # 应用的密钥，用于生成用户 token 等
      # 如果 APP_KEY 修改了，旧的 token 也会随之失效
      # 可以是任意随机字符串，并确保不对外泄露
      - APP_KEY=your-secret-key
      # 数据库类型，支持 postgres, mysql, mariadb
      - DB_DIALECT=mysql
      # 数据库主机，可以替换为已有的数据库服务器 IP
      - DB_HOST=mysql
      # Database port
      - DB_PORT=3306
      # 数据库名
      - DB_DATABASE=nocobase
      # 数据库用户
      - DB_USER=root
      # 数据库密码
      - DB_PASSWORD=nocobase
      # 数据库表名、字段名是否转为 snake case 风格
      - DB_UNDERSCORED=true
      # 时区
      - TZ=Asia/Shanghai
    volumes:
      - ./storage:/app/nocobase/storage
    ports:
      - '13000:80'
    # init: true

  # 如果使用已有数据库服务，可以不启动 mysql
  mysql:
    image: registry.cn-shanghai.aliyuncs.com/nocobase/mysql:8
    environment:
      MYSQL_DATABASE: nocobase
      MYSQL_USER: nocobase
      MYSQL_PASSWORD: nocobase
      MYSQL_ROOT_PASSWORD: nocobase
    restart: always
    volumes:
      - ./storage/db/mysql:/var/lib/mysql
    networks:
      - nocobase
</code></pre>
<p style="">初始账号密码是admin@nocobase.com和admin123</p>
<h2 style="" id="%E4%BD%BF%E7%94%A8"><strong>使用</strong></h2>
<p style="">新建表
 <br>
 基本上都是用普通数据表就够用了</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.1.png&amp;size=m" alt="196.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">新建两张表一级分类和二级分类</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.2.png&amp;size=m" alt="196.2.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.3.png&amp;size=m" alt="196.3.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">然后添加字段</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.4.png&amp;size=m" alt="196.4.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">在二级分类这张表里添加一级分类字段，这里用多对一的关系类型</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F30%2F196.5.png&amp;size=m" alt="196.5.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">表建完后，新建页面</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.6.png&amp;size=m" alt="196.6.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">具体操作如下：</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.7.gif&amp;size=m" alt="196.7.gif" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.8.gif&amp;size=m" alt="196.8.gif" width="100%" height="100%" style="display: inline-block"></p>
<p style="">分类表做完了，再新建记账单表</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.9.png&amp;size=m" alt="196.9.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">再新建相关字段，长图警告。。。</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.10.png&amp;size=m" alt="196.10.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.11.png&amp;size=m" alt="196.11.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.12.png&amp;size=m" alt="196.12.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.13.png&amp;size=m" alt="196.13.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.14.png&amp;size=m" alt="196.14.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F30%2F196.15.png&amp;size=m" alt="196.15.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F30%2F196.16.png&amp;size=m" alt="196.16.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.17.png&amp;size=m" alt="196.17.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">表建完后新建一个记账单的页面，然后按如下操作：</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.18.gif&amp;size=m" alt="196.18.gif" width="100%" height="100%" style="display: inline-block"></p>
<p style="">目前只配置好了桌面端的，移动端的还需要额外再重新设计下，这点太麻烦了。。</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.19.png&amp;size=m" alt="196.19.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.20.png&amp;size=m" alt="196.20.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">手机浏览器打开点击添加到桌面，就能比较方便地随时打开了</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F196.21.jpg&amp;size=m" alt="196.21.jpg" width="25%" height="auto" style="display: inline-block"></p>
<p style="">数据导入字段设置</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F30%2F196.22.gif&amp;size=m" alt="196.22.gif" width="100%" height="100%" style="display: inline-block"></p>
<p style="">制作图表</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F30%2F196.23.gif&amp;size=m" alt="196.23.gif" width="100%" height="100%" style="display: inline-block"></p>]]></description><guid isPermaLink="false">/archives/ji-zhang-hou-xu</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fnocobase.png&amp;size=m" type="image/jpeg" length="4652"/><category>其他</category><pubDate>Mon, 29 Sep 2025 08:58:05 GMT</pubDate></item><item><title><![CDATA[连接网络共享打印机报错0x00000057]]></title><link>https://blog.iffi.top/archives/lian-jie-wang-luo-gong-xiang-da-yin-ji-bao-cuo-0x00000057</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E8%BF%9E%E6%8E%A5%E7%BD%91%E7%BB%9C%E5%85%B1%E4%BA%AB%E6%89%93%E5%8D%B0%E6%9C%BA%E6%8A%A5%E9%94%990x00000057&amp;url=/archives/lian-jie-wang-luo-gong-xiang-da-yin-ji-bao-cuo-0x00000057" width="1" height="1" alt="" style="opacity:0;">
<p style="">解决办法：打开程序和功能，点击启用或关闭windows功能。勾选以下内容</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F195.1.png&amp;size=m" alt="195.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F29%2F195.2.png&amp;size=m" alt="195.2.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">然后电脑重启</p>]]></description><guid isPermaLink="false">/archives/lian-jie-wang-luo-gong-xiang-da-yin-ji-bao-cuo-0x00000057</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fprinter.png&amp;size=m" type="image/jpeg" length="66236"/><category>windows</category><pubDate>Mon, 29 Sep 2025 08:39:42 GMT</pubDate></item><item><title><![CDATA[为了一盘醋，包了一顿饺子（记账之路）]]></title><link>https://blog.iffi.top/archives/wei-liao-yi-pan-cu-bao-liao-yi-dun-jiao-zi-ji-zhang-zhi-lu</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E4%B8%BA%E4%BA%86%E4%B8%80%E7%9B%98%E9%86%8B%EF%BC%8C%E5%8C%85%E4%BA%86%E4%B8%80%E9%A1%BF%E9%A5%BA%E5%AD%90%EF%BC%88%E8%AE%B0%E8%B4%A6%E4%B9%8B%E8%B7%AF%EF%BC%89&amp;url=/archives/wei-liao-yi-pan-cu-bao-liao-yi-dun-jiao-zi-ji-zhang-zhi-lu" width="1" height="1" alt="" style="opacity:0;">
<p style="">目前我已经记了11个月的帐了，市面上的记账软件也了解了不少，期间用过钱迹，还用过一木记账。因为我没有开会员，所以只能用一个账套，也不能上传照片，一木记账连备份都不行。我是有过冲动要开钱迹的会员的，但是又忍住了，谁知道哪天我又要换别的软件呢。我又开始找自建方案，搭过ezBookkeeping和cashbook,但都是体验了一两天被我放弃了，都不是我想要的。我忽然想到了公司在用的简道云，这是个低代码平台，可以自定义想要的功能。
 <br>
 确实简道云几乎完美解决了一切问题，包括数据的导入与导出，输入字段的自定义，仪表盘的自定义显示。</p>
<p style="">下面是我在简道云平台做的一个内容</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.1.png&amp;size=m" alt="194.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.2.png&amp;size=m" alt="194.2.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">但是也有问题，免费版有一些限制，我也不可能去付费。下面是我多次导入数据超了。。超了后就不能再添加数据，必须等到下个月重置数据。</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.3.png&amp;size=m" alt="194.3.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">后面我就打算直接用mysql来存数据，用granafa来显示图表。 这里需要数据的导入，于是我用了phpmyadmin来做数据的导入。</p>
<h2 style="" id="%E5%AE%89%E8%A3%85phpmyadmin"><strong>安装phpmyadmin</strong></h2>
<p style="">docker-compose安装</p>
<pre><code>version: '3'
services:
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "80:80"
    environment:
      - PMA_ARBITRARY=1
    network_mode: bridge
</code></pre>
<p style="">连接数据库后，新建表，这里有个小问题，优惠的数据类型我用了text，本应该用float,因为优惠会出现空值，我已经用了null,但是后面导入数据还是会报错</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.4.png&amp;size=m" alt="194.4.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">数据用csv进行导入
 <br>
 这里有个地方要注意下，excel打开的csv文件保存后默认是ANSI编码，需要用记事本打开该文件再另存为，修改编码为UFT-8</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.5.png&amp;size=m" alt="194.5.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">执行导入</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.6.png&amp;size=m" alt="194.6.png" width="100%" height="100%" style="display: inline-block"></p>
<h2 style="" id="%E5%AE%89%E8%A3%85granafa"><strong>安装granafa</strong></h2>
<p style="">docker-compose安装</p>
<pre><code>services:
 grafana:
   image: grafana/grafana-enterprise
   container_name: grafana
   restart: unless-stopped
   user: '0'
   ports:
    - '3000:3000'
   volumes:
    - '$PWD/data:/var/lib/grafana'
</code></pre>
<p style="">制作图表遇到的坑
 <br>
 1.grfana用transform,选择add filed from calulation,两者相减没有数据
 <br>
 这里我新建了两个query,一个支出，一个收入。然后尝试用转换，将收入减支出，但是没有数据，于是我用下面的方式来做结余数据。</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.7.png&amp;size=m" alt="194.7.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.8.png&amp;size=m" alt="194.8.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">2.仪表盘的时间范围筛选不管用 我想调时间范围，发现没有用，解决办法添加一条where $__timeFilter(start_time)</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.9.png&amp;size=m" alt="194.9.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">3.查询的数据条数限制在50条 默认每次的查询都是50条，而且改不了，勾选order，修改limit</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.10.png&amp;size=m" alt="194.10.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.11.png&amp;size=m" alt="194.11.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">4.增加筛选功能，这里需要添加变量</p>
<p style="">进入仪表盘，点击设置</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.12.png&amp;size=m" alt="194.12.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">选择变量，添加变量</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.13.png&amp;size=m" alt="194.13.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">名字不能是中文</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.14.png&amp;size=m" alt="194.14.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">点击运行查询，可以看到预览值，可以勾选多值，和包含全部</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.15.png&amp;size=m" alt="194.15.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">如果选了多选或全部后，将其改为in ($yijileixing)</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.16.png&amp;size=m" alt="194.16.png" width="100%" height="100%" style="display: inline-block"></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.17.png&amp;size=m" alt="194.17.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">设置好效果如下</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.18.gif&amp;size=m" alt="194.18.gif" width="100%" height="100%" style="display: inline-block"></p>
<p style="">5.当数据为空时不显示内容</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.19.png&amp;size=m" alt="194.19.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">比方这个情况下，没有数据的时候，不显示内容，正常应该将空值显示为0
 <br>
 sql写法如下：</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F09%2F28%2F194.20.png&amp;size=m" alt="194.20.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">虽然数据库有了，图表也有了，但是怎么方便地写入数据呢？手机端难道做一个app?还是小程序？还是网页？就算做出来了，还要加一个登陆验证，还要考虑安全性，防止sql注入等攻击行为。俺不会啊。。先暂时折腾到这一步吧。
 <br>
 蒜鸟蒜鸟，接着用简道云。一个月1千条数据其实够用了。。。</p>]]></description><guid isPermaLink="false">/archives/wei-liao-yi-pan-cu-bao-liao-yi-dun-jiao-zi-ji-zhang-zhi-lu</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Faccount.webp&amp;size=m" type="image/jpeg" length="44936"/><category>其他</category><pubDate>Sun, 28 Sep 2025 08:42:31 GMT</pubDate></item><item><title><![CDATA[windows远程桌面白屏解决办法]]></title><link>https://blog.iffi.top/archives/windowsyuan-cheng-zhuo-mian-bai-ping-jie-jue-ban-fa</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=windows%E8%BF%9C%E7%A8%8B%E6%A1%8C%E9%9D%A2%E7%99%BD%E5%B1%8F%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;url=/archives/windowsyuan-cheng-zhuo-mian-bai-ping-jie-jue-ban-fa" width="1" height="1" alt="" style="opacity:0;">
<p style="">远程桌面出现白屏，无法操作</p>
<p style="">解决办法：按alt+f4，该组合键为关闭当前窗口</p>]]></description><guid isPermaLink="false">/archives/windowsyuan-cheng-zhuo-mian-bai-ping-jie-jue-ban-fa</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fwindows.jpg&amp;size=m" type="image/jpeg" length="12302"/><pubDate>Tue, 6 May 2025 04:36:46 GMT</pubDate></item><item><title><![CDATA[podman重启后容器无法自启动解决办法]]></title><link>https://blog.iffi.top/archives/The-container-cannot-self-start-after-podman-restart-solution</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=podman%E9%87%8D%E5%90%AF%E5%90%8E%E5%AE%B9%E5%99%A8%E6%97%A0%E6%B3%95%E8%87%AA%E5%90%AF%E5%8A%A8%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;url=/archives/The-container-cannot-self-start-after-podman-restart-solution" width="1" height="1" alt="" style="opacity:0;">
<p style="">运行了Podman跑容器的电脑重启后，无法正常启动容器，原因是因为Podman不使用Daemon守护进程，所以podman run命令没有–restart=always参数来重启容器。
 <br>
 解决方案：
 <br>
 生成systemd文件</p>
<pre><code>podman generate systemd --name your-container-name --files --new
</code></pre>
<p style="">将生成的文件移动到/etc/systemd/system</p>
<pre><code>mv container-your-container-name.service /etc/systemd/system/
</code></pre>
<p style="">启动服务</p>
<pre><code>systemctl daemon-reload
systemctl enable container-your-container-name.service
systemctl start container-your-container-name.service</code></pre>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/The-container-cannot-self-start-after-podman-restart-solution</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fpodman.webp&amp;size=m" type="image/jpeg" length="8810"/><category>容器</category><pubDate>Fri, 7 Mar 2025 00:34:02 GMT</pubDate></item><item><title><![CDATA[win7电脑蓝屏，蓝屏代码：0x0000007B]]></title><link>https://blog.iffi.top/archives/win7-computer-blue-screen</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=win7%E7%94%B5%E8%84%91%E8%93%9D%E5%B1%8F%EF%BC%8C%E8%93%9D%E5%B1%8F%E4%BB%A3%E7%A0%81%EF%BC%9A0x0000007B&amp;url=/archives/win7-computer-blue-screen" width="1" height="1" alt="" style="opacity:0;">
<p style=""></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F24%2F191.1.png&amp;size=m" alt="191.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">解决办法：进入bios，将硬盘模式IDE改成AHCI</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F24%2F191.2.png&amp;size=m" alt="191.2.png" width="100%" height="100%" style="display: inline-block"></p>]]></description><guid isPermaLink="false">/archives/win7-computer-blue-screen</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fwin7.png&amp;size=m" type="image/jpeg" length="28498"/><category>windows</category><pubDate>Mon, 24 Feb 2025 02:48:53 GMT</pubDate></item><item><title><![CDATA[Deepseek R1本地部署]]></title><link>https://blog.iffi.top/archives/deepseek-local-deployment</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=Deepseek%20R1%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2&amp;url=/archives/deepseek-local-deployment" width="1" height="1" alt="" style="opacity:0;">
<h1 style="" id="deepseek-r1%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2"><strong>Deepseek R1本地部署</strong></h1>
<h2 style="" id="1.ollama-%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85"><strong>1.Ollama 下载安装</strong></h2>
<p style="">Ollama 是一个轻量级的本地AI模型运行框架，可在本地运行各种开源大语言模型（如Llama、Mistral等）
 <br>
 Ollama官网：<a href="https://ollama.com/">https://ollama.com/</a></p>
<h3 style="" id="1.1-windows%E5%B9%B3%E5%8F%B0%E5%AE%89%E8%A3%85ollama"><strong>1.1 Windows平台安装Ollama</strong></h3>
<h4 style="" id="1.1.1%E5%AE%89%E8%A3%85%E5%AE%A2%E6%88%B7%E7%AB%AF"><strong>1.1.1安装客户端</strong></h4>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.1.png&amp;size=m" alt="190.1.png" width="100%" height="100%" style="display: inline-block"></p>
<h4 style="" id="1.1.2%E5%AE%89%E8%A3%85deepseek-r1%E6%A8%A1%E5%9E%8B"><strong>1.1.2安装DeepSeek-r1模型</strong></h4>
<p style="">还是在刚才的Ollama网站，选择Model模块，选择deepseek-r1这个模型</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.2.png&amp;size=m" alt="190.2.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">Deepseek本地部署硬件要求</p>
<pre><code>1. DeepSeek-R1-1.5B
•	CPU: 最低 4 核（推荐 Intel/AMD 多核处理器）
•	内存: 8GB+
•	硬盘: 3GB+ 存储空间（模型文件约 1.5-2GB）
•	显卡: 非必需（纯 CPU 推理），若 GPU 加速可选 4GB+ 显存（如 GTX 1650）
•	场景:
•	低资源设备部署（如树莓派、旧款笔记本）
•	实时文本生成（聊天机器人、简单问答）
•	嵌入式系统或物联网设备
________________________________________
2. DeepSeek-R1-7B
•	CPU: 8 核以上（推荐现代多核 CPU）
•	内存: 16GB+
•	硬盘: 8GB+（模型文件约 4-5GB）
•	显卡: 推荐 8GB+ 显存（如 RTX 3070/4060）
•	场景:
•	本地开发测试（中小型企业）
•	中等复杂度 NLP 任务（文本摘要、翻译）
•	轻量级多轮对话系统
________________________________________
3. DeepSeek-R1-8B
•	硬件需求: 与 7B 相近，略高 10-20%
•	场景:
•	需更高精度的轻量级任务（如代码生成、逻辑推理）
________________________________________
4. DeepSeek-R1-14B
•	CPU: 12 核以上
•	内存: 32GB+
•	硬盘: 15GB+
•	显卡: 16GB+ 显存（如 RTX 4090 或 A5000）
•	场景:
•	企业级复杂任务（合同分析、报告生成）
•	长文本理解与生成（书籍/论文辅助写作）
________________________________________
5. DeepSeek-R1-32B
•	CPU: 16 核以上（如 AMD Ryzen 9 或 Intel i9）
•	内存: 64GB+
•	硬盘: 30GB+
•	显卡: 24GB+ 显存（如 A100 40GB 或双卡 RTX 3090）
•	场景:
•	高精度专业领域任务（医疗/法律咨询）
•	多模态任务预处理（需结合其他框架）
________________________________________
6. DeepSeek-R1-70B
•	CPU: 32 核以上（服务器级 CPU）
•	内存: 128GB+
•	硬盘: 70GB+
•	显卡: 多卡并行（如 2x A100 80GB 或 4x RTX 4090）
•	场景:
•	科研机构/大型企业（金融预测、大规模数据分析）
•	高复杂度生成任务（创意写作、算法设计）
________________________________________
7. DeepSeek-R1-671B
•	CPU: 64 核以上（服务器集群）
•	内存: 512GB+
•	硬盘: 300GB+
•	显卡: 多节点分布式训练（如 8x A100/H100）
•	场景:
•	国家级/超大规模 AI 研究（如气候建模、基因组分析）
•	通用人工智能（AGI）探索
</code></pre>
<h4 style="" id="1.1.3%E5%AE%89%E8%A3%85%E6%A8%A1%E5%9E%8B"><strong>1.1.3安装模型</strong></h4>
<p style="">本地运行cmd，输入ollama run deepseek-r1:1.5b</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.3.png&amp;size=m" alt="190.3.png" width="100%" height="100%" style="display: inline-block"></p>
<h3 style="" id="1.2-linux%E5%B9%B3%E5%8F%B0%E5%AE%89%E8%A3%85"><strong>1.2 Linux平台安装</strong></h3>
<h4 style="" id="1.2.1%E8%BF%90%E8%A1%8C%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E8%84%9A%E6%9C%AC"><strong>1.2.1运行一键安装脚本</strong></h4>
<pre><code>curl -sSfL https://ollama.com/install.sh | sh
</code></pre>
<p style="">该脚本速度很慢，用手动方式安装</p>
<h4 style="" id="1.2.2%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85"><strong>1.2.2手动安装</strong></h4>
<pre><code>curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz
sudo tar -C /usr -xzf ollama-linux-amd64.tgz
</code></pre>
<p style="">配置服务</p>
<pre><code>sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama
sudo usermod -a -G ollama $(whoami)
</code></pre>
<pre><code>vi /etc/systemd/system/ollama.service
</code></pre>
<p style="">写入以下内容</p>
<pre><code>[Unit]
Description=Ollama Service
After=network-online.target

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_ORIGINS=*"
ExecStart=/usr/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=$PATH"

[Install]
WantedBy=default.target
</code></pre>
<p style="">重启ollama</p>
<pre><code>systemctl daemon-reload
systemctl restart ollama
</code></pre>
<h3 style="" id="1.3%E5%AE%B9%E5%99%A8%E5%B9%B3%E5%8F%B0%E9%83%A8%E7%BD%B2ollama"><strong>1.3容器平台部署ollama</strong></h3>
<h4 style="" id="1.3.1-%E5%88%9B%E5%BB%BAdocker-compose.yml"><strong>1.3.1 创建docker-compose.yml</strong></h4>
<pre><code>vi docker-compose.yml
</code></pre>
<pre><code>version: '3'  
services:  
  ollama:  
    image: ollama/ollama:latest
    container_name: ollama  
    ports:  
      - "11434:11434"  
    volumes:  
      - ./data:/data
</code></pre>
<p style="">进入容器</p>
<pre><code>docker exec -it ollama /bin/bash 
</code></pre>
<p style="">安装模型</p>
<pre><code>ollama run deepseek-r1:1.5b
</code></pre>
<h2 style="" id="2-%E5%AE%89%E8%A3%85openwebui%EF%BC%88web%E7%AB%AF%EF%BC%89"><strong>2 安装openwebui（web端）</strong></h2>
<h3 style="" id="2.1-windows%E5%B9%B3%E5%8F%B0%E5%AE%89%E8%A3%85"><strong>2.1 Windows平台安装</strong></h3>
<h4 style="" id="2.1.1%E5%AE%89%E8%A3%85python3.11"><strong>2.1.1安装python3.11</strong></h4>
<p style="">不要用python3.11以上的版本，否则不兼容
 <br>
 到python官网下载python3.11</p>
<h4 style="" id="2.1.2%E5%AE%89%E8%A3%85open-webui"><strong>2.1.2安装open-webui</strong></h4>
<p style="">Pip换源</p>
<pre><code>pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
</code></pre>
<p style="">安装</p>
<pre><code>pip install open-webui
</code></pre>
<p style="">运行open-webui</p>
<pre><code>open-webui serve
</code></pre>
<p style="">浏览器访问127.0.0.1:8080</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.4.png&amp;size=m" alt="190.4.png" width="100%" height="100%" style="display: inline-block"></p>
<h3 style="" id="2.2-%E5%AE%B9%E5%99%A8%E9%83%A8%E7%BD%B2openwebui"><strong>2.2 容器部署openwebui</strong></h3>
<pre><code>docker run -d -p 8080:8080  --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
</code></pre>
<h2 style="" id="3-%E5%AE%89%E8%A3%85chabox%EF%BC%88%E5%AE%A2%E6%88%B7%E7%AB%AF%EF%BC%89"><strong>3 安装Chabox（客户端）</strong></h2>
<h3 style="" id="3.1%E8%AE%BE%E7%BD%AEapi%E8%BF%9E%E6%8E%A5"><strong>3.1设置api连接</strong></h3>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.5.png&amp;size=m" alt="190.5.png" width="100%" height="100%" style="display: inline-block"></p>
<h3 style="" id="3.2%E5%BC%80%E6%94%BEollama%E5%85%81%E8%AE%B8%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AE"><strong>3.2开放ollama允许远程访问</strong></h3>
<p style="">默认情况下ollama只允许本地访问连接
 <br>
 Windows平台
 <br>
 配置系统环境变量</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.6.png&amp;size=m" alt="190.6.png" width="100%" height="100%" style="display: inline-block"></p>
<h2 style="" id="4-linux%E5%AE%89%E8%A3%85%E6%98%BE%E5%8D%A1%E9%A9%B1%E5%8A%A8"><strong>4 linux安装显卡驱动</strong></h2>
<p style="">查看显卡型号 lspci | grep -i vga</p>
<p style="">更新系统</p>
<pre><code>apt update
apt upgrade
</code></pre>
<p style="">重启</p>
<pre><code>Reboot
</code></pre>
<p style="">禁用 Nouveau 显卡驱动</p>
<pre><code>sudo nano /etc/modprobe.d/blacklist-nouveau.conf
</code></pre>
<p style="">写入以下内容</p>
<pre><code>blacklist nouveau
options nouveau modeset=0
</code></pre>
<p style="">更新 initramfs</p>
<pre><code>sudo update-initramfs -u
</code></pre>
<p style="">重启</p>
<pre><code>Reboot
</code></pre>
<p style="">验证 Nouveau 是否已禁用</p>
<pre><code>lsmod | grep nouveau
</code></pre>
<p style="">没有输出说明已经禁用
 <br>
 添加官方显卡驱动 PPA（可选）</p>
<pre><code>sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
</code></pre>
<p style="">查看推荐的驱动版本</p>
<pre><code>ubuntu-drivers devices
</code></pre>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.7.png&amp;size=m" alt="190.7.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">Recommended是推荐
 <br>
 安装驱动</p>
<pre><code>sudo apt install nvidia-driver-560
</code></pre>
<p style="">安装推荐的驱动</p>
<pre><code>sudo ubuntu-drivers autoinstall
</code></pre>
<p style="">验证安装</p>
<pre><code>nvidia-smi
</code></pre>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.8.png&amp;size=m" alt="190.8.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">移除显卡驱动</p>
<pre><code>sudo apt-get remove --purge '^nvidia-.*'
sudo apt autoremove
</code></pre>
<p style="">如果出现安装显卡驱动自动关机的情况，按如下解决
 <br>
 禁用ACPI电源管理
 <br>
 编辑GRUB配置文件</p>
<pre><code>sudo nano /etc/default/grub
</code></pre>
<p style="">修改为</p>
<pre><code>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=off"
</code></pre>
<p style="">更新GRUB</p>
<pre><code>sudo update-grub
</code></pre>
<p style="">重启</p>
<pre><code>Reboot
</code></pre>
<p style="">如果出现显卡驱动未加载成功，再将acpi重新开启</p>
<h2 style="" id="5-%E5%AE%89%E8%A3%85cuda"><strong>5 安装cuda</strong></h2>
<h3 style="" id="5.1-windows%E5%AE%89%E8%A3%85cuda-toolkit"><strong>5.1 windows安装CUDA toolkit</strong></h3>
<p style="">如果出现运行大模型gpu利用率为0时，尝试安装cuda，再重装ollama
 <br>
 <a href="https://developer.nvidia.com/cuda-toolkit-archive">CUDA Toolkit Archive | NVIDIA Developer</a></p>
<h3 style="" id="5.2-linux%E5%AE%89%E8%A3%85cuda-toolkit"><strong>5.2 linux安装CUDA toolkit</strong></h3>
<p style=""><a href="https://developer.nvidia.com/cuda-toolkit-archive">CUDA Toolkit Archive | NVIDIA Developer</a></p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.9.png&amp;size=m" alt="190.9.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">选择continue</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.10.png&amp;size=m" alt="190.10.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">输入accept</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.11.png&amp;size=m" alt="190.11.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">取消勾选driver</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F02%2F21%2F190.12.png&amp;size=m" alt="190.12.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">配置环境</p>
<pre><code>nano ~/.bashrc
</code></pre>
<p style="">写入</p>
<pre><code>export PATH=$PATH:/usr/local/cuda-12.6/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.6/lib64
</code></pre>
<p style="">重载配置</p>
<pre><code>source ~/.bashrc
</code></pre>
<p style="">检查是否安装成功</p>
<pre><code>nvcc –V</code></pre>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/deepseek-local-deployment</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fdeepseek.png&amp;size=m" type="image/jpeg" length="13509"/><category>AI</category><pubDate>Fri, 21 Feb 2025 08:02:05 GMT</pubDate></item><item><title><![CDATA[免费博客方案：hugo+cloudflare]]></title><link>https://blog.iffi.top/archives/hugo%2Bcloudflare</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=%E5%85%8D%E8%B4%B9%E5%8D%9A%E5%AE%A2%E6%96%B9%E6%A1%88%EF%BC%9Ahugo%2Bcloudflare&amp;url=/archives/hugo%2Bcloudflare" width="1" height="1" alt="" style="opacity:0;">
<h1 style="" id="%E5%B0%86hugo%E9%83%A8%E7%BD%B2%E5%88%B0cloudflare"><strong>将hugo部署到cloudflare</strong></h1>
<h2 style="" id="%E9%83%A8%E7%BD%B2hugo"><strong>部署hugo</strong></h2>
<h3 style="" id="%E4%B8%8B%E8%BD%BDhugo"><strong>下载hugo</strong></h3>
<p style=""><a href="https://github.com/gohugoio/hugo">下载地址</a>
 <br>
 hugo有两个版本，标准版和扩展版，扩展版在标准版基础上增加了对 Sass/SCSS 等预处理语言的支持。我这里选择了windows的extend</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F01%2F17%2F189.1.png&amp;size=m" alt="189.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">解压后，在目录下运行cmd</p>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E6%96%B0%E7%AB%99%E7%82%B9"><strong>创建新站点</strong></h3>
<pre><code>hugo new site newsite
</code></pre>
<p style="">将创建一个名为 newsite 的目录,并进入该目录下，将hugo.exe复制到该目录，或者改全局变量，不然无法执行hugo的命令，之后的命令都在该目录下执行</p>
<h3 style="" id="%E4%B8%8B%E8%BD%BD%E4%B8%BB%E9%A2%98"><strong>下载主题</strong></h3>
<p style="">到<a href="https://themes.gohugo.io/">主题下载</a>,我这里下载的是PaperMod
 <br>
 编辑newsite目录下的hugo.toml</p>
<pre><code>theme = "PaperMod"
</code></pre>
<h3 style="" id="%E6%96%B0%E5%BB%BA%E6%96%87%E7%AB%A0"><strong>新建文章</strong></h3>
<pre><code>hugo new posts/hello world.md
</code></pre>
<p style="">draft: ture代表草稿文件，改成false代表正式发布</p>
<h4 style="" id="%E6%B7%BB%E5%8A%A0%E6%A0%87%E7%AD%BE"><strong>添加标签</strong></h4>
<p style="">tags = ['markdown','blog']</p>
<h3 style="" id="%E6%9C%AC%E5%9C%B0%E9%A2%84%E8%A7%88"><strong>本地预览</strong></h3>
<pre><code>hugo server -D
</code></pre>
<p style="">-D代表输出包括标记为 draft: true 的草稿文章
 <br>
 到浏览器输入127.0.0.1:1313进行访问</p>
<h3 style="" id="%E6%9E%84%E5%BB%BA%E7%BD%91%E7%AB%99"><strong>构建网站</strong></h3>
<p style="">预览觉得没问题后，构建网站生成静态文件</p>
<pre><code>hugo -D
</code></pre>
<p style="">将自动创建public目录，该目录需要上传至cloudflare</p>
<h3 style="" id="%E6%9B%B4%E5%A4%9A%E9%85%8D%E7%BD%AE"><strong>更多配置</strong></h3>
<h4 style="" id="%E6%96%B0%E5%BB%BAabout%E9%A1%B5%E9%9D%A2"><strong>新建about页面</strong></h4>
<p style="">在content目录下新建about.md</p>
<pre><code>+++
title = "关于"
layout = "about"
url = "/about/"
summary = "about"
+++
# 欢迎来到我的小站
这个站点主要做个备份
</code></pre>
<h4 style="" id="%E6%96%B0%E5%BB%BA%E5%BD%92%E6%A1%A3%E9%A1%B5%E9%9D%A2"><strong>新建归档页面</strong></h4>
<p style="">在content目录下新建archives.md</p>
<pre><code>+++
title = "归档"
layout = "archives"
url = "/archives/"
summary = "archives"
+++
</code></pre>
<h4 style="" id="%E6%96%B0%E5%BB%BA%E6%A0%87%E7%AD%BE%E9%A1%B5%E9%9D%A2"><strong>新建标签页面</strong></h4>
<pre><code>hugo new tags/_index.md
</code></pre>
<h4 style="" id="%E8%87%AA%E5%AE%9A%E4%B9%89%E9%85%8D%E7%BD%AE"><strong>自定义配置</strong></h4>
<pre><code># 基本配置
baseURL = 'https://example.com/'    //域名
languageCode = 'zh-cn'    //中文
title = 'site'            //站点名称
theme = "PaperMod"        //主题名称
paginate = 10             //首页每页显示的文章数

# 参数配置
[params]
  description = "This is my personal website"
  author = "qiaoqiao"         //作者名
  defaultTheme = "auto"       //默认主题颜色
  ShowToc = true              //显示目录
  TocOpen = false             //目录默认是否展开
  ShowWordCount = true        //字数统计
  ShowReadingTime = true      //阅读时间
  comments = false            //全局评论
# 菜单配置 
[menu]
  [[menu.main]]
    name = "🏡Home"
    url = "/"
    weight = 1
  [[menu.main]]
    name = "📄归档"
    url = "/archives"
    weight = 2
  [[menu.main]]
    name = "✒️文章"
    url = "/posts/"
    weight = 3
  [[menu.main]]
    name = "📌tags"
    url = "/tags/"
    weight = 4
  [[menu.main]]
    name = "👁️‍🗨️About"
    url = "/about/"
    weight = 5
# 自定义首页显示内容
[params.homeInfoParams]
  Title = "Welcome to My Blog"
  Content = "This is my personal blog where I share my thoughts and ideas."
</code></pre>
<h4 style="" id="logo%E8%AE%BE%E7%BD%AE"><strong>logo设置</strong></h4>
<p style="">logo.ico上传到static/images目录下,默认会被PaperMod识别加载</p>
<h2 style="" id="%E4%B8%8A%E4%BC%A0cloudflare"><strong>上传cloudflare</strong></h2>
<h3 style="" id="%E5%B0%86%E7%94%9F%E6%88%90%E7%9A%84public%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8A%E4%BC%A0"><strong>将生成的public文件夹上传</strong></h3>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F01%2F17%2F189.2.png&amp;size=m" alt="189.2.png" width="100%" height="100%" style="display: inline-block"></p>
<h3 style="" id="%E9%85%8D%E7%BD%AE%E5%9F%9F%E5%90%8D"><strong>配置域名</strong></h3>
<p style="">配置的域名需要托管在cloudflare下</p>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F01%2F17%2F189.3.png&amp;size=m" alt="189.3.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">直接访问自定义的域名，cloudflare自动配置了https,完成</p>]]></description><guid isPermaLink="false">/archives/hugo%2Bcloudflare</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fhugo.png&amp;size=m" type="image/jpeg" length="39385"/><category>其他</category><pubDate>Fri, 17 Jan 2025 03:25:12 GMT</pubDate></item><item><title><![CDATA[Fail2ban防止暴力攻击]]></title><link>https://blog.iffi.top/archives/fail2ban-Prevent-violent-assault</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=Fail2ban%E9%98%B2%E6%AD%A2%E6%9A%B4%E5%8A%9B%E6%94%BB%E5%87%BB&amp;url=/archives/fail2ban-Prevent-violent-assault" width="1" height="1" alt="" style="opacity:0;">
<p style="">最近查看了下vps的的登录情况，发现大量的ssh登录失败日志，即使我改了默认的ssh端口也没什么用，所以只能用其他的办法来解决问题。
 <br>
 Fail2Ban 是一个用于防止暴力攻击的开源工具，它通过监控日志文件来检测恶意行为（如多次失败的登录尝试），并根据配置的规则自动封禁相关 IP 地址，用这个工具就可以防止某个IP重复的暴力破解。
 <br>
 查看ssh登录失败日志</p>
<pre><code>cat /var/log/auth.log | grep sshd | grep Failed
</code></pre>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F01%2F09%2F188.1.png&amp;size=m" alt="188.1.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">在介绍fail2ban之前我先写下我是怎么给linux做基础防护的。
 <br>
 首先就是创建一个管理员账号，然后设置禁止root远程登录</p>
<pre><code>adduser newadmin    //创建账号
usermod -aG sudo newadmin   //将用户添加sudo组
groups newadmin   //查看是否在sudo组
cat /etc/passwd   //查看所有用户
</code></pre>
<h2 style="" id="%E9%85%8D%E7%BD%AE%E7%A6%81%E6%AD%A2root-ssh%E7%99%BB%E5%BD%95"><strong>配置禁止root ssh登录</strong></h2>
<pre><code>nano /etc/ssh/sshd_config
</code></pre>
<pre><code>PermitRootLogin no
</code></pre>
<pre><code>systemctl restart sshd
</code></pre>
<h2 style="" id="%E4%BF%AE%E6%94%B9ssh%E7%AB%AF%E5%8F%A3"><strong>修改ssh端口</strong></h2>
<pre><code>nano /etc/ssh/sshd_config
</code></pre>
<p style="">去掉#，port 22改成其他端口</p>
<p style="">重启ssh：systemctl restart sshd</p>
<p style="">ubuntu22.10版本后重启ssh，端口未成功修改</p>
<p style="">解决办法：</p>
<pre><code>systemctl daemon-reload
systemctl restart ssh.socket
</code></pre>
<h2 style="" id="%E5%AE%89%E8%A3%85fail2ban"><strong>安装Fail2ban</strong></h2>
<pre><code>sudo apt-get install fail2ban -y
</code></pre>
<p style="">检查 Fail2Ban 状态：</p>
<pre><code>sudo systemctl status fail2ban
</code></pre>
<h2 style="" id="%E4%BF%AE%E6%94%B9%E9%85%8D%E7%BD%AE"><strong>修改配置</strong></h2>
<p style="">Fail2Ban 的配置文件位于 /etc/fail2ban/ 目录下。建议不要直接修改默认配置文件，而是创建自定义配置文件。
 <br>
 fail2ban.conf是默认缺省配置，jail.conf是默认监视配置</p>
<pre><code>sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local
</code></pre>
<p style="">找到[ssh]部分,增加内容</p>
<pre><code>[sshd]
ignoreip = 127.0.0.1/8  #忽略的IP地址
enabled = true
filter = sshd
port = 22
maxretry = 5       #允许的最大失败次数
findtime = 300     #在指定时间内达到失败次数即封禁
bantime = 600      #封禁时间，单位秒
logpath = /var/log/auth.log   #ssh登录日志位置
</code></pre>
<p style="">修改完配置需要重启</p>
<pre><code>sudo systemctl restart fail2ban
</code></pre>
<p style="">查看sshd服务具体状态</p>
<pre><code>sudo fail2ban-client status sshd
</code></pre>
<p style="">手动封禁 IP：</p>
<pre><code>sudo fail2ban-client set sshd banip 192.168.1.2
</code></pre>
<p style="">手动解封 IP：</p>
<pre><code>sudo fail2ban-client set sshd unbanip 192.168.1.2
</code></pre>
<p style="">Fail2Ban 的日志文件位于 /var/log/fail2ban.log，可以查看封禁记录和操作日志。</p>
<pre><code>sudo cat /var/log/fail2ban.log
</code></pre>
<p style=""><img src="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Flsky.docpan.top%2Fi%2F2025%2F01%2F09%2F188.2.png&amp;size=m" alt="188.2.png" width="100%" height="100%" style="display: inline-block"></p>
<p style="">这里可以看到115.190.105.174尝试5次后被封禁就停止ssh登录了，但是94.103.125.224尝试5次后又登录了几次后停止ssh登录，也许是115那个IP是每隔20多秒登录一次，94那个IP是一秒登录三次，系统没反应过来？不过设置后登录日志就少了很多，算是相对安全了些。</p>
<p style="">如果出现封禁ip无效
 <br>
 查看防火墙规则</p>
<pre><code>sudo iptables -L -n
</code></pre>
<p style="">检查是否有 Fail2Ban 的规则通常以 f2b- 开头</p>]]></description><guid isPermaLink="false">/archives/fail2ban-Prevent-violent-assault</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Ffail2ban.jpg&amp;size=m" type="image/jpeg" length="40985"/><category>linux</category><pubDate>Thu, 9 Jan 2025 01:28:53 GMT</pubDate></item><item><title><![CDATA[wireguard配置多节点组网]]></title><link>https://blog.iffi.top/archives/wireguard-configure-a-multi-node-network</link><description><![CDATA[<img src="https://blog.iffi.top/plugins/feed/assets/telemetry.gif?title=wireguard%E9%85%8D%E7%BD%AE%E5%A4%9A%E8%8A%82%E7%82%B9%E7%BB%84%E7%BD%91&amp;url=/archives/wireguard-configure-a-multi-node-network" width="1" height="1" alt="" style="opacity:0;">
<h1 style="" id="%E4%BB%8B%E7%BB%8D"><strong>介绍</strong></h1>
<p style="">wireguard是一种现代、高效且易于配置的 VPN 协议，以其简洁性和高性能著称</p>
<h1 style="" id="%E5%87%86%E5%A4%87"><strong>准备</strong></h1>
<p style="">准备一台云服务器，主要目的是需要一台公网的设备，通过这台服务器再组建一个局域网，达到多个节点互访。</p>
<h1 style="" id="%E5%AE%89%E8%A3%85"><strong>安装</strong></h1>
<p style="">服务端配置
 <br>
 安装wireguard</p>
<pre><code>apt-get install wireguard -y
</code></pre>
<p style="">开启ipv4流量转发</p>
<pre><code>echo "net.ipv4.ip_forward = 1" &gt;&gt; /etc/sysctl.conf
sysctl -p
</code></pre>
<p style="">进入目录</p>
<pre><code>cd /etc/wireguard
</code></pre>
<p style="">生成服务器公钥和私钥</p>
<pre><code>wg genkey &gt; server.key  #生成私钥
wg pubkey &lt; server.key &gt; server.key.pub  #通过私钥生成公钥
</code></pre>
<p style="">生成客户端公钥和私钥</p>
<pre><code>wg genkey &gt; client1.key  #生成私钥
wg pubkey &lt; client1.key &gt; client1.key.pub  #通过私钥生成公钥
</code></pre>
<p style="">创建配置文件</p>
<pre><code>vi /etc/wireguard/wg0.conf
</code></pre>
<pre><code>[Interface]
Address = 10.10.0.1/24  # 服务器虚拟 IP 地址
ListenPort = 51820      # WireGuard 监听端口
PrivateKey = 服务器私钥  # 替换为生成的私钥

# 允许通过 VPN 转发的流量
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
#eth0是网卡名称
[Peer]
PublicKey = 客户端公钥  # 替换为客户端公钥
AllowedIPs = 10.10.0.2/32  # 客户端虚拟 IP 地址
</code></pre>
<p style="">启动wireguard</p>
<pre><code>wg-quick up wg0
</code></pre>
<p style="">设置开机自启</p>
<pre><code>systemctl enable wg-quick@wg0
</code></pre>
<p style="">客户端配置
 <br>
 安装略
 <br>
 创建配置文件wg0.conf</p>
<pre><code>[Interface]
Address = 10.10.0.2/24  # 客户端虚拟 IP 地址
PrivateKey = 客户端私钥  # 替换为生成的私钥

[Peer]
PublicKey = 服务器公钥  # 替换为服务器公钥
Endpoint = 服务器公网IP:51820  # 替换为服务器公网 IP 和端口
AllowedIPs = 10.10.0.0/24  # 允许服务器IP
PersistentKeepalive = 25
</code></pre>
<p style="">启动wireguard</p>
<pre><code>wg-quick up wg0
</code></pre>
<p style="">设置开机自启</p>
<pre><code>systemctl enable wg-quick@wg0
</code></pre>
<p style="">ps:多个客户端配置，需要在服务器配置文件添加多个peer
 <br>
 验证连接</p>
<pre><code>wg
</code></pre>
<p style="">现在还有一个去中心化的组网方案：EasyTier，有空也可以部署看看</p>]]></description><guid isPermaLink="false">/archives/wireguard-configure-a-multi-node-network</guid><dc:creator>qiaoqiao</dc:creator><enclosure url="https://blog.iffi.top/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fwireguard.png&amp;size=m" type="image/jpeg" length="31927"/><category>网络</category><category>linux</category><pubDate>Thu, 2 Jan 2025 07:06:19 GMT</pubDate></item></channel></rss>