普通视图

发现新文章,点击刷新页面。
昨天以前ikeno blog

mac软件推荐

2024年12月13日 08:00

2024年度最香产品:MAC MINI M4 正式登场! 经过几天的抢购,我终于在京东买到了 MAC MINI M4,发货等了一个月。到手后折腾了几天,虽然新鲜劲儿过了,但作为办公电脑,它的表现还是不错的。 回想上次用 Mac Mini 是在 M1 刚发售时,买来玩了几个月,最后发现自己并没有太大需求,于是出掉了。这次我以 3500 元的价格再买了一台 M4,希望它能作为我的工作电脑。

废话不多说,下面是我这边记录的一些已安装的软件,都是一些必备的好用软件:

  1. Microsoft Office/Excel/PPT 三件套 办公必备,没啥好介绍的,工作中一定会用到,比 WPS 好用多了。

  2. BetterDisplay 我用的是 4K 显示器,分辨率适配后字体变得非常小,图标和软件也显得很小。为了不降低分辨率,我使用了 BetterDisplay,这个软件不仅能调整分辨率,还能修改亮度,算是一个不错的解决方案。

  3. 超级右键 Mac 里的复制、粘贴、删除等操作相比 Windows 确实不那么顺手。超级右键可以扩展右键功能,例如直接快速打开常用目录、删除文件、新建文件、剪切粘贴等,使用起来非常便利。

  4. VSCode 宇宙第一 IDE,不解释。

  5. Termius 用来登录服务器。Windows 上一般使用 MobaXterm,因此在 Mac 上也想找一个好用的终端,最终发现 Termius 非常好用。

  6. 有道翻译 主要用于划词翻译,记单词、翻译句子等,算是学习英语的工具。不过有时复制时容易误点。

  7. Chrome 习惯了跨系统的多端浏览器同步书签,所以还是选择 Chrome 浏览器。

  8. CotEditor 我想找一个类似 Notepad++ 的轻量级文本编辑器。试了几个 Atom 之类的,感觉都太繁琐。后来在商店里发现 CotEditor,确实不错,功能够用。

  9. Pixea 比系统自带的图片浏览器好用,简洁方便。

  10. ClashX 懂的都懂,实用的梯子。

  11. Keeweb 密码管理软件,使用体验还不错。

希望这些软件能对使用 Mac Mini 的朋友们有所帮助!

2023sumppary

2023年12月28日 08:00

迟来的2023年终总结:

<audio controls> <source src="http://music.163.com/song/media/outer/url?id=409872504.mp3" type="audio/mpeg"> </audio>

关于工作

工作今年算运气不错吧,去年年底被裁员后,本来以为以咱的垃圾学历和技术,再加上互联网寒冬,估计要失业蛮久的。但运气看来还好,不到一个月就找到了新公司,薪资变化不大,不加班,标准的975,比之前公司感觉好了很多。好像我找工作一直都运气蛮好的,平均面试3次基本上都有一次可以过,毕业到现在也有8年多了吧,从上海到深圳,换了也有4家公司了,这是第五家了,平均2年一家公司,然后有一家是被裁员,也算是什么都经历过了。也不清楚程序员这行能干多久,有存款才有勇气。

关于开发

今年工作有了时间,就想着完成一些以前就想做的开发项目了,博客也算之一,所以就有了这个博客,虽然是用的开源的框架,但也弄了些自己的东西,例如分享啊,数据统计啊,评论,域名,CDN什么的,虽然没什么流量,但在网络上有了自己的一个网站还是蛮开心的。

除了博客外因为今年chatgpt的普及,很多以前很费时间的技术都可以简单的开发了,例如前端页面之类的,虽然技术力有限,但还是弄了一个chrome插件游戏来玩玩,还是蛮有趣的,以后有好点子说不定还可以继续开发一些好玩的浏览器插件。

关于旅游

今年总算可以正常出国旅游了,5月去了上海玩3天,10月去了东京-京都-大阪玩了8天。抛开工作烦恼和国内的压力,能到国外享受旅游真的很放松,看什么都很新鲜。就是国庆旅游花费贵了些,明年应该会办理三年多次的签证,以后淡季去玩应该会便宜很多。希望明年可以有另一半可以一起旅游hh

关于游戏

看了下PlayStation的游玩记录,今年竟然都没有超过10小时的ps5游戏时间,甚至都弄不出年度游玩报告,看来今年大部分时间都是在玩电脑和手游了,现在独占游戏越来越少,steam价格也便宜,还可以打mod。看来以后主机的使用率应该还会变低。明年还有老头环DLC、碧蓝幻想relink、黑神话,还是蛮期待的。

最后

感觉也没啥总结的了,希望明年越来越好吧,暴富!脱单!

AI绘画工具webui简单入门 之 高清化

2023年3月19日 08:00

Webui直接生成出来的图会很模糊,而且有些地方细节不是很好,如果用作4k壁纸会感觉很别扭,所以需要高清修复。

步骤

打开webui的图生图,调整参数为:

  • 缩放模式:拉伸
  • 采样方法(Sampler):DPM adaptive
  • 宽度和高度在原有的基础上+64 :1280*720 --> 1344*784
  • 重绘幅度(Denoising):0.15
  • 脚本:使用SD放大(SD upscale)
  • 放大算法:R-ESRGAN 4x+ Anime6B

其他参数默认即可,最后点击生成等待成果吧!

放大前:

放大前|inline

放大后:

放大后|inline

其他

最后再推荐一个网站,如果想要把生成的图做壁纸的话,可以把动漫图片用算法最大放大到2k甚至4K。
waifu2x

写在地下城邂逅Ⅳ·灾厄篇·完结之后

2023年3月18日 08:00

BGM

TV动画《期待在地下城邂逅有错吗 Ⅳ 深章 灾厄篇》片尾曲 切り傷
歌手:sajou no hana

<audio controls> <source src="http://music.163.com/song/media/outer/url?id=2024541034.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>

感想

地错第四季也终于完结啦,新番里最好看的,不枉我每周四蹲首播啃生肉看完,这一季完完整整的把小说第14卷全部一次性讲完啦,完全是琉主场,琉的过去,眷族团灭的原因以及琉内心的变化,

最后也终于释怀了自己的过去,找到了属于自己的正义! 加入白兔后宫团(不是

不得不给节操社(J.C.STAFF)点个赞,还是保持了一贯的高制作水准,没有特别的崩坏,这一季看下来不管是剧情节奏还是画面音乐都非常棒!果然很喜欢这种王道的剧情啊,男孩与女孩的相遇,互相拯救的故事什么的,真是太棒了!

最后一幕琉的笑容真的太 太 太好看啦!

最近也把新的18卷小说看完了,白兔终于也到level5了,女神芙蕾雅线故事的高潮阶段也终于全部讲完,最后琉Level6救场的场景太帅啦!最后还直球告白贝尔!我宣布,琉股暴涨!诸君,我喜欢elf!

琉|inline

最后

外传剑姬神圣谭13 14卷貌似也快出了,看来大森真的想把每一个地错的角色魅力和眷族故事都展示出来,大森你给点力,学学某河马打字机,多出点!孩子爱看!

AI绘画工具webui简单入门 之 工具安装

2023年3月14日 08:00

工具下载地址:

stable-diffusion-webui (推荐)

1.下载完成后运行webui-user.bat文件,会下载相关的依赖,国内网络可能需要翻墙或者用镜像站(修改launch.py文件把github地址都改为国内的镜像站地址),也可以推荐dev-sidecar这个免费工具加速github。 或者可以直接上b站检索秋葉aaakiup主,直接下载整合包,再或者直接下载第三方客户端

2.安装完成后再运行webui-user.bat文件后等待出现Running on local URL: http://127.0.0.1:7860 就可以访问127.0.0.1:7860打开webui页面啦。

3.打开后先别急,需要安装一些基础的插件,点击扩展,从网址安装,然后把git地址粘贴后安装即可,我这边推荐几个最常用的:

汉化插件 安装完后:setting >> user interface >> Localization (requires restart) >> 选择 zh-CN >> apply setting >> reload ui

Control插件 用来加载lora相关模型。

关键字补全插件 用来补全prompt关键字的,适合英文小白~

4.安装完成后到设置里的显示所有页面快捷设置列表填写sd_model_checkpoint,sd_vae然后重启webui,基础工具就安装好啦,接下来就是模型了!

模型下载地址:

Civitai

1.注册好账号后就可以查看很多网上分享的模型,找一个你最喜欢的,例如Counterfeit,点击下载即可。

2.下载好后记得要把模型放到 \webui\models\Stable-diffusion 目录下,这样才会读取到模型,Lora的模型要放到\webui\models\Lora里,有模型后就可以生成AI图片啦!

当然只是简单的模型还是不够的,后续进阶还需要用到vae模型,EasyNegative模型,lora模型,openpose模型,高清化等,这个后续有时间再梳理下,慢慢学习进步!

分享例子:

关键字: ((masterpiece,best quality)),1girl, solo, animal ears, rabbit, barefoot, knees up, dress, sitting, rabbit ears, short sleeves, looking at viewer, grass, short hair, smile, white hair, puffy sleeves, outdoors, puffy short sleeves, bangs, on ground, full body, animal, white dress, sunlight, brown eyes, dappled sunlight, day, depth of field

Negative关键字: EasyNegative, extra fingers,fewer fingers,

Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 10, Seed: 414619472, Size: 512x728, Model hash: 59ea4aa1d8, Model: cetusMix_cetusVersion3, Denoising strength: 0.7, Hires upscale: 2, Hires steps: 20, Hires upscaler: SwinIR_4x

兔子|inline

Markdown Example

2022年10月1日 08:00

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one
  • the other one

Note that --- not considering the asterisk --- the actual text content starts at 4-columns in.

Block quotes are written like so.

They can span multiple paragraphs, if you like.

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all in chapters 12--14"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺

An h2 header

Here's a numbered list:

  1. first item
  2. second item
  3. third item

Note again how the actual text starts at 4 columns in (4 characters from the left side). Here's a code sample:

# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }

As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like:

define foobar() {
    print "Welcome to flavor country!";
}

(which makes copying & pasting easier). You can optionally mark the delimited block for Pandoc to syntax highlight it:

import time
# Quick, count to ten!
for i in range(10):
    # (but not *too* quick)
    time.sleep(0.5)
    print i

An h3 header

Now a nested list:

  1. First, get these ingredients:

    • carrots
    • celery
    • lentils
  2. Boil some water.

  3. Dump everything in the pot and follow this algorithm:

     find wooden spoon
     unimage pot
     stir
     image pot
     balance wooden spoon precariously on pot handle
     wait 10 minutes
     goto first step (or shut off burner when done)
    

    Do not bump wooden spoon or it will fall.

Notice again how text always lines up on 4-space indents (including that last line which continues item 3 above).

Here's a link to a website, to a local doc, and to a section heading in the current doc. Here's a footnote [^1].

[^1]: Footnote text goes here.

Tables can look like this:

size material color


9 leather brown 10 hemp canvas natural 11 glass transparent

Table: Shoes, their sizes, and what they're made of

(The above is the caption for the table.) Pandoc also supports multi-line tables:


keyword text


red Sunsets, apples, and other red or reddish things.

green Leaves, grass, frogs and other things it's not easy being.


A horizontal rule follows.


Here's a definition list:

apples : Good for making applesauce. oranges : Citrus! tomatoes : There's no "e" in tomatoe.

Again, text is indented 4 spaces. (Put a blank line between each term/definition pair to spread things out more.)

Here's a "line block":

| Line one | Line too | Line tree

and images can be specified like so:

Inline math equations go in like so: $\omega = d\phi / dt$. Display math should get its own line and be put in in double-dollarsigns:

$$I = \int \rho R^{2} dV$$

And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: `foo`, *bar*, etc.

Simple Guides for Fuwari

2022年4月1日 08:00

image image source: Source

This blog template is built with Astro. For the things that are not mentioned in this guide, you may find the answers in the Astro Docs.

Front-matter of Posts

---
title: My First Blog Post
published: 2023-09-09
description: This is the first post of my new Astro blog.
image: ./image.jpg
tags: [Foo, Bar]
category: Front-end
draft: false
---
Attribute Description
title The title of the post.
published The date the post was published.
description A short description of the post. Displayed on index page.
image The image image path of the post.<br/>1. Start with http:// or https://: Use web image<br/>2. Start with /: For image in public dir<br/>3. With none of the prefixes: Relative to the markdown file
tags The tags of the post.
category The category of the post.
draft If this post is still a draft, which won't be displayed.

Where to Place the Post Files

Your post files should be placed in src/content/posts/ directory. You can also create sub-directories to better organize your posts and assets.

src/content/posts/
├── post-1.md
└── post-2/
    ├── image.png
    └── index.md

Simple Guides for Fuwari

2024年4月1日 08:00

Cover image source: Source

This blog template is built with Astro. For the things that are not mentioned in this guide, you may find the answers in the Astro Docs.

Front-matter of Posts

---
title: My First Blog Post
published: 2023-09-09
description: This is the first post of my new Astro blog.
image: ./cover.jpg
tags: [Foo, Bar]
category: Front-end
draft: false
---
Attribute Description
title The title of the post.
published The date the post was published.
description A short description of the post. Displayed on index page.
image The cover image path of the post.<br/>1. Start with http:// or https://: Use web image<br/>2. Start with /: For image in public dir<br/>3. With none of the prefixes: Relative to the markdown file
tags The tags of the post.
category The category of the post.
draft If this post is still a draft, which won't be displayed.

Where to Place the Post Files

Your post files should be placed in src/content/posts/ directory. You can also create sub-directories to better organize your posts and assets.

src/content/posts/
├── post-1.md
└── post-2/
    ├── cover.png
    └── index.md

Markdown Example

2023年10月1日 08:00

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one
  • the other one

Note that --- not considering the asterisk --- the actual text content starts at 4-columns in.

Block quotes are written like so.

They can span multiple paragraphs, if you like.

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all in chapters 12--14"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺

An h2 header

Here's a numbered list:

  1. first item
  2. second item
  3. third item

Note again how the actual text starts at 4 columns in (4 characters from the left side). Here's a code sample:

# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }

As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like:

define foobar() {
    print "Welcome to flavor country!";
}

(which makes copying & pasting easier). You can optionally mark the delimited block for Pandoc to syntax highlight it:

import time
# Quick, count to ten!
for i in range(10):
    # (but not *too* quick)
    time.sleep(0.5)
    print i

An h3 header

Now a nested list:

  1. First, get these ingredients:

    • carrots
    • celery
    • lentils
  2. Boil some water.

  3. Dump everything in the pot and follow this algorithm:

     find wooden spoon
     uncover pot
     stir
     cover pot
     balance wooden spoon precariously on pot handle
     wait 10 minutes
     goto first step (or shut off burner when done)
    

    Do not bump wooden spoon or it will fall.

Notice again how text always lines up on 4-space indents (including that last line which continues item 3 above).

Here's a link to a website, to a local doc, and to a section heading in the current doc. Here's a footnote [^1].

[^1]: Footnote text goes here.

Tables can look like this:

size material color


9 leather brown 10 hemp canvas natural 11 glass transparent

Table: Shoes, their sizes, and what they're made of

(The above is the caption for the table.) Pandoc also supports multi-line tables:


keyword text


red Sunsets, apples, and other red or reddish things.

green Leaves, grass, frogs and other things it's not easy being.


A horizontal rule follows.


Here's a definition list:

apples : Good for making applesauce. oranges : Citrus! tomatoes : There's no "e" in tomatoe.

Again, text is indented 4 spaces. (Put a blank line between each term/definition pair to spread things out more.)

Here's a "line block":

| Line one | Line too | Line tree

and images can be specified like so:

Inline math equations go in like so: $\omega = d\phi / dt$. Display math should get its own line and be put in in double-dollarsigns:

$$I = \int \rho R^{2} dV$$

And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: `foo`, *bar*, etc.

Include Video in the Posts

2023年8月1日 08:00

Just copy the embed code from YouTube or other platforms, and paste it in the markdown file.

---
title: Include Video in the Post
published: 2023-10-19
// ...
---

<iframe width="100%" height="468" src="https://www.youtube.com/embed/5gIf0_xpFPI?si=N1WTorLKL0uwLsU_" title="YouTube video player" frameborder="0" allowfullscreen></iframe>

YouTube

<iframe width="100%" height="468" src="https://www.youtube.com/embed/5gIf0_xpFPI?si=N1WTorLKL0uwLsU_" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Bilibili

<iframe width="100%" height="468" src="//player.bilibili.com/player.html?bvid=BV1fK4y1s7Qf&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

用Siri来控制Windows电脑开机关机吧

2024年2月26日 08:00

前因

自从手机从iphone换成Android后,咱的13香就没啥用了,只能放桌子上当时钟,感觉有点浪费啊,所以研究了下苹果的HomeKit,用旧手机当智能中控岂不更好!网上查了下,貌似也蛮简单的。开搞开搞!

准备

  1. 买一个能够连接homekit的智能插座,网上蛮多的,一个插座也就20~50不等,我买的是meross的,好像说是外贸货,反正到手是日本那边的,还行。买来后插上电,用手机先连接2.4g的wifi后扫描下二维码后按提示就可以让插座联网了,加入后只要网络正常,就可以用手机控制插座开关了。
  2. 设置电脑bios,通电后自动启动机器。我的外星人台式机是开机后按F2就可以进入bios,然后找到高级选项--电源选项里有个开机改成通电就Power On就好了。
  3. 给Windows账号加上密码,就是登陆要输入密码才能登陆,这样可以让其他手机或者服务器进行ssh登陆。
  4. 电脑安装OpenSSH。打开Powershell,然后Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0命令,出现进度条后等待安装完毕。然后net start sshd即可启动ssh服务。当然别忘了在防火墙的入站规则里加上TCP的22端口规则允许。还有就是在Windows的服务里找到OpenSSH然后手动改成自动,这样就开机自动启动啦。然后还有就是要把电脑的IP改成静态的,不能DHCP动态分配。最后可以尝试在Powershell里ssh 你的用户名@你的服务器IP,然后输入你的密码就可以正常SSH登陆啦!

嘿 Siri

  1. 准备工作都弄完后,现在就轮到iphone了,先在家庭里创建2个场景,一个是关电脑,就是控制插座关闭电源,另一个的开电脑,控制插座开启电源。弄完后点击试试,看看插座是不是可以正常点一下就开启和关闭了。
  2. 打开苹果的快捷指令,创建一个新的快捷指令,名称叫打开电脑,里面只需要添加开电脑的场景即可。这样只需要喊"嘿!sir,打开电脑" ,就可以开启插座然后通电开机啦。
  3. 再创建一个新的快捷指令,名称叫关闭电脑,然后添加通过SSH发送命令,把服务器的ip、22端口号、用户名、密码都填写,脚本的话填写shutdown -s -t 1。然后再添加等待60秒,最后再添加关电脑的场景即可。这样通过siri喊"嘿!sir,关闭电脑",就可以实现快速关机了!

语音控制

上面通过嘿siri来控制快捷指令来运行关机貌似会有点小问题,因为要等待60s后才会执行下一步,siri好像默认不会等那么久,所以换一种方式,用iphone的辅助功能。里面有个语音控制,开启后新增语音关闭电脑然后运行对应的快捷指令即可,这下连siri都不用了,直接说关闭电脑就好了!

控制中台

iphone的家庭里其实还有一个小功能,就是开启引导界面,然后输入密码设置,你会发现界面会钉在家庭的控制页面,且不会切换,这样就相当于把手机作为了中台,只需要连接电源然后挂在墙上或者桌子上,就可以当一个完美的控制中台啦~

最后

家里马上也要开始装修弄家具了,之前也有了解一些智能家居,但感觉都不是很实用,大部分也就是一些回家后自动开灯,开电器。起床自动打开窗帘和播放音乐之类的,为了这些多花好几万感觉不是很划算,那还不如就简单点用智能插座加场景设置和快捷指令来控制,这样成本低,自己diy,体验也不错。虽然有一些局限性,但本来就图新鲜,好玩就行了~

如何使用Clickhouse的索引

2023年10月18日 08:00

简介

    影响ClickHouse查询性能的因素很多。在大多数情况下,关键因素是ClickHouse在计算查询WHERE子句条件时是否可以使用主键。因此,选择适用于最常见查询模式的主键对于有效的表设计至关重要。     用户通常依赖ClickHouse获取时间序列类型的数据,但他们通常希望根据其他业务维度(如客户id、网站URL或产品编号)分析相同的数据。在这种情况下,查询性能可能会相当差,因为可能需要对每个列值进行完整扫描才能应用WHERE子句条件。虽然ClickHouse在这些情况下仍然相对较快,但评估数百万或数十亿个单独的值将导致“非索引”查询的执行速度比基于主键的查询慢得多。     ClickHouse提供了一种不同类型的索引,在特定情况下可以显著提高查询速度。这些结构被标记为“跳过(Skip)”索引,因为它们使ClickHouse能够跳过读取保证没有匹配值的重要数据块。

介绍

Clickhouse索引的特点为: 排序索引+稀疏索引+列式存储, 因此相应的Clickhouse最合适的场景就是基于排序字段的范围过滤后的聚合查询。

因为排序索引, 所有基于排序字段的查询会明显由于MR类型计算, 否则Hive/Spark这类动态资源的更优 由于稀疏索引, 点查询的效率可能没有KV型数据库高, 因此适合相对大范围的过滤条件 因为列式存储, 数据压缩率高, 对应做聚合查询效率也会更高.

实践

因为表索引不好在创建表后再进行创建,所以最好在创建表的时候就计划好并创建,例如cloki的表主要是samples_v3和time_series_gin表是用作主要查询。
对于cloki.time_series_gin表:
对key列进行索引:ALTER TABLE cloki.time_series_gin_ ADD INDEX idx_key(key) TYPE minmax GRANULARITY 8192;
对val列进行索引:ALTER TABLE cloki.time_series_gin_ ADD INDEX idx_val(val) TYPE minmax GRANULARITY 8192;
对fingerprint列进行索引:ALTER TABLE cloki.time_series_gin_ ADD INDEX idx_fingerprint(fingerprint) TYPE minmax GRANULARITY 8192;

对于cloki.samples_v3表:
对timestamp_ns列进行索引:ALTER TABLE cloki.samples_v3_ ADD INDEX idx_timestamp_ns(timestamp_ns) TYPE minmax GRANULARITY 8192;
对fingerprint列进行索引:ALTER TABLE cloki.samples_v3_ ADD INDEX idx_fingerprint(fingerprint) TYPE minmax GRANULARITY 8192;
对string列进行索引:ALTER TABLE cloki.samples_v3_ ADD INDEX idx_string(string) TYPE minmax GRANULARITY 8192;

如果需要对已有的数据也进行索引,需要 ALTER TABLE cloki.samples_v3_ MATERIALIZE INDEX idx_timestamp_ns; 数据量较大,会非常慢。

参考

官方文档
深入浅出clickhouse-index

使用ilogtail+cloki+clickhouse来做日志系统吧

2023年8月30日 08:00

相关开源工具

  • clickhouse 【文档:https://clickhouse.com/docs/zh】
  • cloki 【文档:https://qryn.metrico.in/#/installation】
  • ilogtail 【文档:https://ilogtail.gitbook.io/】

简介

clickhouse就不说了,可以参考我前面的博文,这里主要介绍一下cloki和ilogtail。

ilogtail是阿里开源的一款轻量级的日志采集工具,针对k8s环境也有很好的优化,比filebeat轻,资源消耗低,采集效率也快一些。目前官方也支持多种输入、处理和输出, 其中就包含输出到loki或者clickhouse。(要注意logtail是阿里自带的一个日志采集工具,只能采集到阿里的sls,ilogtail是开源社区的,支持多种插件)

cloki也是国外开源的一个工具,类似于loki,API也和loki一模一样,但是后台可以关联到更高效的clickhouse作为存储。(目前相关文章不多,但可用)

部署

因为所有的都是部署在k8s上的,所以直接上yaml文件吧

cloki

cloki-deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloki
  labels:
    io.metrico.service: cloki
spec:
  replicas: 1
  selector:
    matchLabels:
      io.metrico.service: cloki
  strategy: {}
  template:
    metadata:
      annotations:
        qryn.cmd: qryn.dev
      creationTimestamp: null
      labels:
        io.metrico.service: cloki
    spec:
      containers:
        - env:
            - name: CLICKHOUSE_SERVER                   # 具体配置参考文档
              value: clickhouse                     
            - name: CLICKHOUSE_AUTH
              value: 'default:xxxxxx'
            - name: CLICKHOUSE_PORT
              value: '8123'
            - name: CLICKHOUSE_DB
              value: cloki
            - name: CLICKHOUSE_TSDB
              value: cloki
            - name: FASTIFY_METRICS
              value: 'true'
            - name: DEBUG
              value: 'true'
            - name: FASTIFY_BODYLIMIT
              value: '52428800'
            - name: CLUSTER_NAME     #用于ck集群
              value: 'my_cluster'
          image: qxip/qryn:latest
          name: cloki
          ports:
            - containerPort: 3100
          resources: {}
      restartPolicy: Always
status: {}

cloki-service.yml

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    io.metrico.service: cloki
  name: cloki
spec:
  ports:
    - name: "3100"
      port: 3100
      targetPort: 3100
  selector:
    io.metrico.service: cloki
status:
  loadBalancer: {}

kubectl apply -f cloki-service.yaml,cloki-deployment.yaml -n ops

ilogtai

ilogtail-configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: ilogtail-user-cm
  namespace: ops
data:
  loki_stdout.yaml: |
    enable: true
    inputs:
      - Type: service_docker_stdout
        Stderr: false
        Stdout: true                # 只采集标准输出
        IncludeK8sLabel:            # 采集nginx的日志,这里可以修改为label或者其他指定,具体看文档
          app: nginx
    processors:
      - Type: processor_default    # 默认不做数据处理
        SourceKey: content
    flushers:
      - Type: flusher_loki         #输出也可以改成stdout来测试,或者直接输出到clickhouse,具体看文档
        URL: http://cloki:3100/loki/api/v1/push
        TenantID: ilogtail
        StaticLabels:
          source: ilogtail

ilogtail-daemonset.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ilogtail-ds
  namespace: ops
  labels:
    k8s-app: logtail-ds
spec:
  selector:
    matchLabels:
      k8s-app: logtail-ds
  template:
    metadata:
      labels:
        k8s-app: logtail-ds
    spec:
      tolerations:
        - operator: Exists                    # deploy on all nodes
      containers:
        - name: logtail
          env:
            - name: ALIYUN_LOG_ENV_TAGS       # add log tags from env
              value: _node_name_|_node_ip_
            - name: _node_name_
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
            - name: _node_ip_
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.hostIP
            - name: cpu_usage_limit           # iLogtail's self monitor cpu limit
              value: "1"
            - name: mem_usage_limit           # iLogtail's self monitor mem limit
              value: "512"
          image: >-
            sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail:latest
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              cpu: 1000m
              memory: 1Gi
            requests:
              cpu: 400m
              memory: 384Mi
          volumeMounts:
            - mountPath: /var/run                       # for container runtime socket
              name: run
            - mountPath: /logtail_host                  # for log access on the node
              mountPropagation: HostToContainer
              name: root
              readOnly: true
            - mountPath: /usr/local/ilogtail/checkpoint # for checkpoint between container restart
              name: checkpoint
            - mountPath: /usr/local/ilogtail/user_yaml_config.d # mount config dir
              name: user-config
              readOnly: true
      dnsPolicy: ClusterFirstWithHostNet
      hostNetwork: true
      volumes:
        - hostPath:
            path: /var/run
            type: Directory
          name: run
        - hostPath:
            path: /
            type: Directory
          name: root
        - hostPath:
            path: /etc/ilogtail-ilogtail-ds/checkpoint
            type: DirectoryOrCreate
          name: checkpoint
        - configMap:
            defaultMode: 420
            name: ilogtail-user-cm
          name: user-config

部署完后ilogtail就作为daemonset开始采集nginx的日志并输出到cloki里啦,因为loki是可以直接与grafana集成的,所以只需要在grafana里把cloki作为数据源加上,就可以直接可视化查询了!

简单搭建国内也可以使用的chatgpt

2023年4月6日 08:00

起因

因为目前chatgpt是禁止国内访问的(包括HK和TW),所以要访问chatgpt就得翻墙,但是目前我用的梯子都非常不稳定! 经常性的掉线,就很烦,2023年了,没法用google和chatgpt还怎么当程序员!经过我github上翻来翻去,总算找到几个 大佬开源的webui,再配上vercel或railway之类的应用托管网站,然后再配上自己的域名,完美解决了国内访问问题!

PS:目前chatgpt的web界面是免费的,只要你注册了openai账号,就可以一直使用,但是api不是,免费账号 使用api只能用3个月,且有额度限制,我的第一批注册的用户基本上4月1号就都过期了,虽然api付费很便宜,基本上10美元 可以用一年,但需要绑定国外的卡,国内只能用depay之类的虚拟信用卡,很麻烦orz

准备

  • Yidadaa/ChatGPT-Next-Web 这个webui界面简洁,对移动端优化也不错,但只支持apikey方式使用。

  • Chanzhaoyu/chatgpt-web 这个webui支持apikey方式也支持session-token的方式。

  • adams549659584/go-proxy-bingai 新增一个bing的,github页面里有详细的介绍,基本上也是可以一键部署。

  • 自己的域名(需要注册阿里云账号,然后填写信息模板申请后购买域名,一般top的域名第一年只需要9块钱)

搭建

搭建方式其实都差不多

  1. 点击进入到对应的github项目里,然后fork项目到自己的仓库里。
  2. 打开vercel 或者 railway,用github账号登陆。
  3. 新建project,选择从github仓库里导入,选择对应的仓库(如果找不到仓库,则需要加一下权限)。
  4. 按提示,需要填写一些环境变量,具体变量参考项目里的README,这里举例: ChatGPT-Next-WebOPENAI_API_KEY :你的apikey
    CODE :自定义访问密码

    chatgpt-web:
    OPENAI_API_KEYOPENAI_ACCESS_TOKEN 二选一(OPENAI_ACCESS_TOKEN的话可以登陆chat.openai.com获取) AUTH_SECRET_KEY : 你的session
    PORT : 3002
  5. 点击部署,等待部署完成。
  6. 点击domain,新建你的domain,例如我的是chat.ikeno.top,然后会生成一个cname的地址
  7. 登陆阿里云账号的DNS解析里,找到我的ikeno.top新增二级域名前缀chat,对应解析为cname,然后把地址也填写上cname.vercel-dns.com(如果是railway的填railway提供的地址),新增完毕后就可以解析成功啦!
  8. 登陆你的域名看看,是不是已经可以正常访问了!而且不需要梯子了,手机也可以流畅访问!输入你设置好的账号密码就可以丝滑提问啦。
❌
❌