Skip to content

Instantly share code, notes, and snippets.

@vagetablechicken
vagetablechicken / readme.md
Created August 12, 2024 02:28
WSL2 网络配置

How to make LAN access wsl2 ports

wsl2 mirrored mode is not experimental now, but some tutorial still use the old style.

WSL 版本: 2.2.4.0
内核版本: 5.15.153.1-2
WSLg 版本: 1.0.61
MSRDC 版本: 1.2.5326
Direct3D 版本: 1.611.1-81528511
DXCore 版本: 10.0.26091.1-240325-1447.ge-release
@vagetablechicken
vagetablechicken / gist:fcf4ce0f8ba22a87c54955b9a0692797
Last active April 29, 2024 06:53
openmldb tablet配置变更或升级
tablet配置变更或升级,统一都是用pre-upgrade和post-upgrade。
**迁移过程中需要停写,否则可能有数据丢失。**
注意集群中的table特点,分两种情况:
1. 有大量table是单副本,pre-upgrade是要把分片挪给别的机器,中途内存占用会变多,可能迁的途中导致OOM。内存吃紧时,
可以新建tablet server,pre-upgrade每次都是挑replica总数最少的机器,基本上就是p2p地传到新tablet server上。不用担心其他tablet会上涨很多。
2. 大部分table都是多副本表,无需担心内存,本质上只做changeleader,不涉及数据迁移。但注意,不停写的话,数据可能丢失。
步骤:
1. 通过showtablestatus来确认集群现状,参考 https://openmldb.ai/docs/zh/main/maintain/openmldb_ops.html。注意请使用0.9.0以上的tools,对0.8.x兼容。重点看Replica列,是1还是大于1。
2. 确认是上文的哪种情况,大部分表是单副本还是多副本。
@vagetablechicken
vagetablechicken / readme.md
Last active April 8, 2024 08:13
TTL Merge Logic

stdTTL: to avoid ttl like absorlat(10,0), the simpler form should be abs(10). If not standard, we may get too large merged ttl, otherwise we should check the values if == 0. Standard is better.

so after std, we may get two ttl, abs(0), abs(x), lat(0), lat(x), absandlat(x,y), absorlat(x,y), x>0 and y>0.

lat(0) to abs(0)?

If two ttl are the same type, it's ok to merge the value, 0 means never exipres.

If different types, I'll try my best to set a small ttl to cover the two ttl.

{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}

scripts about cmd, github gh cli ...

@vagetablechicken
vagetablechicken / sdk.mri
Last active June 25, 2023 10:45
The right way to merge libs
create libopenmldbsdk.a
addlib /home/huangwei/OpenMLDB/build/src/sdk/libopenmldb_api.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_sdk.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_codec.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_catalog.a
addlib /home/huangwei/OpenMLDB/build/src/libschema.a
addlib /home/huangwei/OpenMLDB/build/src/libclient.a
addlib /home/huangwei/OpenMLDB/build/src/libzk_client.a
addlib /home/huangwei/OpenMLDB/build/src/libbase.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_flags.a
@vagetablechicken
vagetablechicken / dlopen_test.cc
Created June 14, 2023 04:12
test load udf so
#include <dlfcn.h>
#include <stdio.h>
int main(void) {
void *handle;
char *error;
handle = dlopen("libtest_udf.so", RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
import requests
import json
# detect table status about data
db = 'disk_test'
ns_leader = '172.24.4.27:7123'
url = f'http://{ns_leader}/NameServer/ShowTable'
res = requests.get(url, json={"show_all": True})
tables = json.loads(res.text)['table_info']
@vagetablechicken
vagetablechicken / diagnose.py
Last active March 28, 2023 08:36
template fix to inspect offline ls
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@vagetablechicken
vagetablechicken / README.md
Created July 20, 2022 08:24
openmldb test sample

openmldb/bin/openmldb --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < test.sql 即可 注意test.sql内,c1.csv的路径,需要跟taskmanager(spark.home=local)在同一台机器上,并且写绝对路径。 输出结果里都是SUCCEED,没有ERROR就可以。