-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1560 lines (1096 loc) · 70.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta name="generator" content="Hugo 0.64.1" />
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noodp"/>
<meta name="author" content="linjinbao66">
<meta name="description" content="打工笔记">
<meta name="keywords" content="博客 个人 笔记">
<link rel="canonical" href="https://amrom66.github.io/" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<title>
打工笔记
</title>
<meta name="title" content="打工笔记">
<link rel="stylesheet" href="/font/iconfont.css">
<link rel="stylesheet" href="/css/main.min.css">
<link href="https://amrom66.github.io/index.xml" rel="alternate" type="application/rss+xml" title="打工笔记" />
<link href="https://amrom66.github.io/index.xml" rel="feed" type="application/rss+xml" title="打工笔记" />
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https:\/\/amrom66.github.io\/",
"name": "打工笔记",
"author": {
"@type": "Person",
"name": "linjinbao66"
},
"description": "打工笔记",
}
</script>
</head>
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-160203449-2', 'auto');
ga('send', 'pageview');
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<body class="">
<div class="wrapper">
<nav class="navbar">
<div class="container">
<div class="navbar-header header-logo">
<a href="javascript:void(0);" class="theme-switch"><i class="iconfont icon-xihuan"></i></a> <a href="https://amrom66.github.io">打工笔记</a>
</div>
<div class="menu navbar-right">
<a class="menu-item" href="/posts/" title="">博客</a>
<a class="menu-item" href="/categories/" title="">分类</a>
<a class="menu-item" href="/tags/" title="">标签</a>
<a class="menu-item" href="/2020/about/" title="关于">关于</a>
</div>
</div>
</nav>
<nav class="navbar-mobile" id="nav-mobile" style="display: none">
<div class="container">
<div class="navbar-header">
<div>
<a href="javascript:void(0);" class="theme-switch"><i class="iconfont icon-xihuan"></i></a>
<a href="https://amrom66.github.io">打工笔记</a>
</div>
<div class="menu-toggle">
<svg t="1618556759902" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1299" width="16" height="16"><path d="M896 1024h-213.333333a128 128 0 0 1-128-128v-213.333333a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128z m-213.333333-384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667v-213.333333a42.666667 42.666667 0 0 0-42.666667-42.666667z m-341.333334 384H128a128 128 0 0 1-128-128v-213.333333a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128z m-213.333333-384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667v-213.333333a42.666667 42.666667 0 0 0-42.666667-42.666667z m768-170.666667h-213.333333a128 128 0 0 1-128-128V128a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128z m-213.333333-384a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667V128a42.666667 42.666667 0 0 0-42.666667-42.666667z m-341.333334 384H128a128 128 0 0 1-128-128V128a128 128 0 0 1 128-128h213.333333a128 128 0 0 1 128 128v213.333333a128 128 0 0 1-128 128zM128 85.333333a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333a42.666667 42.666667 0 0 0 42.666667 42.666667h213.333333a42.666667 42.666667 0 0 0 42.666667-42.666667V128a42.666667 42.666667 0 0 0-42.666667-42.666667z" p-id="1300"></path></svg>
</div>
</div>
<div class="menu" id="mobile-menu">
<a class="menu-item" href="/posts/" title="">博客</a>
<a class="menu-item" href="/categories/" title="">分类</a>
<a class="menu-item" href="/tags/" title="">标签</a>
<a class="menu-item" href="/2020/about/" title="关于">关于</a>
</div>
</div>
</nav>
<main class="main">
<div class="container">
<div class="post-warp">
<div class="intro">
<div class="avatar">
<a href="/"> <img src="/images/me/touxiang.jpeg"> </a>
</div>
<h2 class="description">
Across the great wall, we can reach the world
</h2>
</div>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2024/2024-05-15-read-to-do-something/">不得不做的事情</a></h1>
</header>
<div class="post-content">
有些事情,20岁不做,30岁也要做;30岁不做,40岁还会去做
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2024-05-15 itemprop="datePublished">May 15, 2024</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2024/2024-02-26-quicksort/">quick sort</a></h1>
</header>
<div class="post-content">
快速排序思想 选定pivot中心轴(一般选择最左侧) 将大于pivot的数字放在左侧 将小于pivot的数字放在右侧 递归pivot左侧和右侧的数列 代码实现: public void quickSort(int[] nums) { int length = nums.length; quickSort(nums, 0, length - 1); } public void quickSort(int[] nums, int start, int end) { if (start >= end) { return; } int left = start; int right = end; int pivot = nums[left]; while (left < right) { while (left < right && nums[right] > pivot) { right--; } if (left < right) { nums[left] = nums[right]; left++; } while (left < right && nums[left] < pivot) { left++; } if (left < right) { nums[right] = nums[left]; right--; } } nums[left] = pivot; quickSort(nums, start, left - 1); quickSort(nums, left + 1, end); }
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2024-02-26 itemprop="datePublished">February 26, 2024</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2023/2023-05-04-v2ray-dns/">v2ray-dns-gateway</a></h1>
</header>
<div class="post-content">
分享一个v2ray旁路网关配置 实现的效果 在路由器中配置dhcp地址为该设备的ip 所有由该路由器分配ip的设备流量全部有该设备接管 该设备为一个普通的Linux设备,安装v2ray即可 config.json { "inbounds": [ { "tag": "transparent", "port": 12345, "protocol": "dokodemo-door", "settings": { "network": "tcp,udp", "followRedirect": true }, "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "streamSettings": { "sockopt": { "tproxy": "tproxy", "mark": 255 } } }, { "port": 1080, "protocol": "socks", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "settings": { "auth": "noauth" } } ], "outbounds": [ { "tag": "proxy", "protocol": "vmess", "settings": { "vnext": [ { "address": "remote ip", "port": 10086, "users": [ { "id": "***-***-***-***-***", "alterId": 0, "security": "auto" } ] } ] }, "streamSettings": { "sockopt": { "mark": 255 }, "network": "ws", "wsSettings": { "path": "/", "headers": { "Host": "" } } }, "mux": { "enabled": true } }, { "tag": "direct", "protocol": "freedom", "settings": { "domainStrategy": "UseIP" }, "streamSettings": { "sockopt": { "mark": 255 } } }, { "tag": "block", "protocol": "blackhole", "settings": { "response": { "type": "http" } } }, { "tag": "dns-out", "protocol": "dns", "streamSettings": { "sockopt": { "mark": 255 } } } ], "dns": { "servers": [ { "address": "223.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2023-05-04 itemprop="datePublished">May 4, 2023</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2023/2023-01-11-mysql-schedule/">mysql-schedule</a></h1>
</header>
<div class="post-content">
create event clean_xxl_job on schedule every 1 day do truncate xxl_job_log ;
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2023-01-11 itemprop="datePublished">January 11, 2023</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-12-16-v2er/">v2网友的一首诗</a></h1>
</header>
<div class="post-content">
@onice
纽约时间比加州时间早三个小时,
但加州时间并没有变慢。
有人 22 岁就毕业了,
但等了五年才找到好的工作!
有人 25 岁就当上 CEO ,
却在 50 岁去世。
也有人迟到 50 岁才当上 CEO ,
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-12-16 itemprop="datePublished">December 16, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-10-26-how-to-create-a-java-archive-file-with-jdk/">how-to-create-a-java-archive-file-with-jdk</a></h1>
</header>
<div class="post-content">
JAR 文件支持广泛的功能,包括电子签名、版本控制、包封和其他功能。是什么给了一个 JAR 文件这样的多功能性?
答案是 JAR 文件的清单( manifest.)。
清单是一个特殊的文件,可以包含有关打包在 JAR 文件中的文件的信息。通过调整清单中包含的meta/ meta信息,可以启用 JAR 文件以实现各种目的。
以下,演示如何从普通的java文件打包成jar文件:
MultiThread.java:
import java.lang.management.ManagementFactory;import java.lang.management.ThreadInfo;import java.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-10-26 itemprop="datePublished">October 26, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-10-26-isvalid/">有效的括号</a></h1>
</header>
<div class="post-content">
题目描述: 给定一个只包括'(',')','{','}','[',']'的字符串 s ,判断字符串是否有效。
有效字符串需满足:
左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合。 每个右括号都有一个对应的相同类型的左括号。
示例 1:
输入:s = "()"输出:true示例 2:输入:s = "()[]{}"输出:true示例 3:输入:s = "(]"输出:false提示:1 <= s.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-10-26 itemprop="datePublished">October 26, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-09-21-how-to-access-my-server-with-a-pod/">一个线上服务远程访问的方案</a></h1>
</header>
<div class="post-content">
背景 kubernetes集群在内网中 服务部署在kubernetes集群中 允许暴露一个端口,可以远程访问 目的 访问内网服务的mysql redis mongodb 方案一 部署一套archery,通过端口暴露到公网,实现远程访问
缺点:只能访问特定服务,archery比较厚重
方案二 内网部署一个pod,运行ssh客户端,预装常用工具,mysql-client,redis-cli等
tmp.yaml
apiVersion: v1 kind: Pod metadata: name: my-svc labels: app.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-09-21 itemprop="datePublished">September 21, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-08-16-mvn-generate-project/">mvn-generate-project</a></h1>
</header>
<div class="post-content">
use mvn cli to generate a project:
mvn archetype:generate -DgroupId=tk.amrom -DartifactId=proto-java -DinteractiveMode=false -DoutputDirectory=./ explain:
use plugin archetype:generate require args groutId and artifactId and DinteractiveMode
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-08-16 itemprop="datePublished">August 16, 2022</time>
</span>
in
</div>
<div class="post-tags">
<span class="tag"><a href="https://amrom66.github.io/tags/maven/">
#maven</a></span>
<span class="tag"><a href="https://amrom66.github.io/tags/mvn/">
#mvn</a></span>
<span class="tag"><a href="https://amrom66.github.io/tags/java/">
#java</a></span>
<span class="tag"><a href="https://amrom66.github.io/tags/cli/">
#cli</a></span>
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-07-14-mysql-1k-columns/">mysql生成宽表脚本</a></h1>
</header>
<div class="post-content">
需求描述 生成一张有1000个字段的表,每个字段的类型随机,用测试使用。
解决方案 shell脚本生成建表sql generate_sql.sh
#!/bin/bash echo "USE amrom;" echo "CREATE TABLE ONE_K_COLS (" for (( i = 0; i < 999; i++ )) { col_type=`echo "tinyint int(11) bigint(20) varchar(50) char(30) date $RANDOM" | awk '{print $($NF%(NF-1)+1)}'` suffix=`cat /proc/sys/kernel/random/uuid | cut -f5 -d"-"` echo "col"_$suffix' '${col_type}',' } echo "id int auto_increment," echo "primary key (id)" echo ") engine=innodb;" exit 0 使用方式:.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-07-14 itemprop="datePublished">July 14, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-06-11-multiple-container-in-one-pod/">multiple-container-in-one-pod</a></h1>
</header>
<div class="post-content">
在kubernetes中,默认场景下,initContainers中的容器是按照顺序启动的,且存在先后依赖关系,即前一个启动完了,才会启动后一个,containers中则是按照顺序启动,但是不存在依赖关系,这就给一些使用场景带来了麻烦。例如,在使用pod作为流水线的时候,containers中的容器顺序需要存在先后依赖关系。以下记录一些实践方案:
方案一 利用原生的postStart机制,该机制保证了后一个容器在前一个容器发出该信号前不会创建。
实例:
apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: my-pipline name: my-pipline spec: volumes: - name: data emptyDir: {} initContainers: - image: "alpine/git" name: prepare env: - name: repo value: "https://github.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-06-11 itemprop="datePublished">June 11, 2022</time>
</span>
in
</div>
<div class="post-tags">
<span class="tag"><a href="https://amrom66.github.io/tags/kubernetes/">
#kubernetes</a></span>
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-06-07-kubernetes-binary-upgrade/">kubernetes二进制部署升级</a></h1>
</header>
<div class="post-content">
前提 k8s的部署方式基本上有2中,其一是全部利用kubeadm部署,这种方式会以static pod形式部署各个组件,升级的时候按照kubeadm的手册就行,需要先使用kubeadm upgrade plan获得提示,第二种部署方式是组件全部以二进制形式部署,这种部署的升级的时候需要手动操作,以下记录了一次升级操作的过程。
组件 升级前 升级后 Etcd 3.4.15 3.4.15 kube-apiserver 1.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-06-07 itemprop="datePublished">June 7, 2022</time>
</span>
in
</div>
<div class="post-tags">
<span class="tag"><a href="https://amrom66.github.io/tags/kubernetes/">
#kubernetes</a></span>
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-05-19-upgrade-kernel/">cetos升级内核</a></h1>
</header>
<div class="post-content">
背景 发现了一个netns的问题,在v站提问了https://v2ex.com/t/853722#reply2,最后决定升级内核.
upgrade-kernel.sh # 载入公钥 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org # 安装ELRepo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm # 载入elrepo-kernel元数据 yum --disablerepo=\* --enablerepo=elrepo-kernel repolist # 查看可用的rpm包 yum --disablerepo=\* --enablerepo=elrepo-kernel list kernel* # 安装长期支持版本的kernel yum --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-lt.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-05-19 itemprop="datePublished">May 19, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-05-12-use-deployment-simuator-daemonset/">使用deployment来模拟daemonset</a></h1>
</header>
<div class="post-content">
一个yaml文件
apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: id: very-important name: deploy-important namespace: project-tiger spec: replicas: 3 selector: matchLabels: id: very-important strategy: {} template: metadata: creationTimestamp: null labels: id: very-important spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - topologyKey: kubernetes.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-05-12 itemprop="datePublished">May 12, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-04-26-linux-namespace-overview/">linux network namespace 详解</a></h1>
</header>
<div class="post-content">
网络名称空间 linux 网络空间用于管理容器的网络,编排工具创建容器的时候往往会为容器创建一个独立的namespace,然后将容器的网络与宿主机的网络打通,即可实现容器与外部网络的通信。
linux namespace的操作命令是ip netns
使用实例 创建一个namespace
[root@localhost ~]# ip netns add net1 [root@localhost ~]# ip netns ls net1 net0 [root@localhost ~]# ip netns exec net1 ip addr 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 不同namespace通信
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-04-26 itemprop="datePublished">April 26, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-04-22-multus-cni/">k8sd多网卡方案</a></h1>
</header>
<div class="post-content">
简介 k8s中,默认为每个容器分配一个网卡,(除了lookback回环外),在一些特定场景下,需要指定网卡信息,或者增加网卡,则需要制定多网卡方案。 场景如下: 应用启动时候需要检查mac和ip地址和证书验证,此时如果使用默认的动态网卡方案,则签发的证书无法长期生效。
方案 使用方案 multus-cni 该方案,会在每个节点部署守护进程,根据pod上的注解信息,决定添加自定义网卡。GitHub地址:https://github.com/k8snetworkplumbingwg/multus-cni.git
使用 第一步 部署crd文件,multus-daemonset-thick-plugin.yml
--- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: network-attachment-definitions.k8s.cni.cncf.io spec: group: k8s.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-04-22 itemprop="datePublished">April 22, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-04-03-network-policy/">network-policy</a></h1>
</header>
<div class="post-content">
一个网络隔离策略讲解 apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: my-networkpolicy namespace: mysql spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: name: internal ports: - protocol: TCP port: 8080 解释 该策略:
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-04-03 itemprop="datePublished">April 3, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-03-31-pod-configmap/">pod挂载configmap</a></h1>
</header>
<div class="post-content">
nginx.yaml
apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: nginx name: nginx spec: containers: - image: nginx imagePullPolicy: IfNotPresent name: nginx resources: {} env: - name: option # name of the env variable valueFrom: configMapKeyRef: name: options # name of config map key: var5 # name of the entity in config map dnsPolicy: ClusterFirst restartPolicy: Never status: {} options.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-03-31 itemprop="datePublished">March 31, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-03-13-mysql-privileges/">mysql权限高级</a></h1>
</header>
<div class="post-content">
问题: 如何创建一个新用户,并屏蔽旧库权限?
答案: 问题是对mysql的权限理解有问题。 mysql的权限有2个操作符,grant(授予)和revoke(撤销)。旧库的权限是不能屏蔽的,必须每一个剔除允许的列表。
操作实例
create user 'test'@'%' identified by '123456'; grant all privileges on `test%` to 'test'@'%'; 以上操作会给予test用户,作用域test开头的所有库的所有权限。
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-03-12 itemprop="datePublished">March 12, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-03-10-about-pv-pvc/">关于pv pvc的新认识</a></h1>
</header>
<div class="post-content">
新认识
hostpath可以直接使用 apiVersion: v1 kind: Pod metadata: name: pod-hostpath spec: nodeSelector: kubernetes.io/hostname: i-6fns0nua containers: - image: busybox name: app volumeMounts: - mountPath: /logs name: shared-dir args: - /bin/sh - -c - echo hostpath >> /logs/app.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-03-10 itemprop="datePublished">March 10, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-03-03-esxi-cloud-init/">esxi-cloud-init使用</a></h1>
</header>
<div class="post-content">
esxi是虚拟化的常见方案,其直接部署到物理机上,在之上可以虚拟化出来不同的系统。部署一个虚拟机,我们常见的操作方式是登录esxi的控制台或者vcenter的控制台操作,步骤比较繁琐。
cloud-init是云厂商常用的方案,用于工作在虚拟机初始化的时候。例如,原生部署虚拟机的时候,需要在网页上设置磁盘,用户,网络等等,在cloud-init中,这些不必操作;原生部署虚拟机的时候,无法添加自定义源,cloud-init可以实现。
使用到的工具 govc govc 是vmware出的cli工具,用于操作vcenter
第一步 配置esxi.env配置 # vCenter host export GOVC_URL=192.168.123.138 # vCenter credentials export [email protected] export GOVC_PASSWORD=rpK0qGVhd#YIxP4~S26+ # disable cert validation export GOVC_INSECURE=1 export GOVC_DATASTORE=bigdata export GOVC_NETWORK="" export GOVC_RESOURCE_POOL='default-cluster/Resources' export GOVC_DATACENTER=default-dc jinbao666lin@jinbao666deMacBook-Pro govc-practice % govc about FullName: VMware vCenter Server 6.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-03-03 itemprop="datePublished">March 3, 2022</time>
</span>
in
</div>
<div class="post-tags">
<span class="tag"><a href="https://amrom66.github.io/tags/%E8%99%9A%E6%8B%9F%E5%8C%96/">
#虚拟化</a></span>
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-02-28-etcd-clean/">etcd强制删除k8s数据</a></h1>
</header>
<div class="post-content">
k8s由于各种原因,导致pod等数据一直处于terminting状态中,可以考虑到etcd中强制删除
#检索pod数据 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/ca.key get /registry/pod --prefix --keys-only #根据关键字清楚 export ssss=calico etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/ca.key get /registry --prefix --keys-only | grep ${ssss} | xargs -I{} etcdctl --endpoints=https://127.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-02-28 itemprop="datePublished">February 28, 2022</time>
</span>
in
</div>
<div class="post-tags">
<span class="tag"><a href="https://amrom66.github.io/tags/etcd/">
#etcd</a></span>
<span class="tag"><a href="https://amrom66.github.io/tags/kubernetes/">
#kubernetes</a></span>
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2022/2022-02-16-node-note/">node节点安装笔记</a></h1>
</header>
<div class="post-content">
node节点安装笔记
yum install containerd.io cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf overlay br_netfilter EOF sudo modprobe overlay sudo modprobe br_netfilter # Setup required sysctl params, these persist across reboots.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2022-02-16 itemprop="datePublished">February 16, 2022</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-11-29-iptables/">iptables操作实例</a></h1>
</header>
<div class="post-content">
4个表:filter,mangle,nat,raw
3个链:PREROUTING,PREROUTING,PREROUTING
iptabls基本操作示例 查看规则 查看规则集
iptables --list -n 加一个-n以数字形式显示IP和端口,而不是默认的服务名称
修改规则 配置默认规则,不允许数据进入
iptables -P INPUT DROP 允许转发
iptables -P FORWARD ACCEPT 不允许数据流出
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-11-29 itemprop="datePublished">November 29, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-10-28-kubeconfig/">kubeconfig签发</a></h1>
</header>
<div class="post-content">
签发一个kubeconfig文件的详细流程 大致步骤:
cfssl证书 定义集群 定义用户 定义上下文 绑定角色 cfssl证书 ca-config.json cfssl的配置文件
{ "signing": { "default": { "expiry": "87600h" }, "profiles": { "kubernetes": { "usages": [ "signing", "key encipherment", "server auth", "client auth" ], "expiry": "876000h" } } } } user-csr.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-10-28 itemprop="datePublished">October 28, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-21-cloudflare-worker/">cloudflare worker使用</a></h1>
</header>
<div class="post-content">
部署ariang到cloudflare workers
mkdir -p ariang/public cd ariang/public wget https://github.com/mayswind/AriaNg/releases/download/1.1.7/AriaNg-1.1.7.zip unzip AriaNg-1.1.7.zip rm -f AriaNg-1.1.7.zip cd .. wrangler init --site ariang wrangler config wrangler publish wrangler.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-21 itemprop="datePublished">August 21, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-20-golang-build/">golang交叉编译</a></h1>
</header>
<div class="post-content">
Golang 支持在一个平台下生成另一个平台可执行程序的交叉编译功能。
1、Mac下编译Linux, Windows平台的64位可执行程序 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build test.go CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build test.go 2、Linux下编译Mac, Windows平台的64位可执行程序 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build test.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-20 itemprop="datePublished">August 20, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-18-oci/">关于镜像oci规范</a></h1>
</header>
<div class="post-content">
早就知道镜像存在OCI规范,就是在镜像的元数据中加入一些表明镜像信息的标签,不知道如何,一次偶然就会在github的流水线中看到了,记录下来:
{ "target": { "docker-metadata-action": { "tags": [ "ghcr.io/linjinbao666/conda-base:main" ], "labels": { "org.opencontainers.image.title": "conda-base", "org.opencontainers.image.description": "conda-base", "org.opencontainers.image.url": "https://github.com/linjinbao666/conda-base", "org.opencontainers.image.source": "https://github.com/linjinbao666/conda-base", "org.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-18 itemprop="datePublished">August 18, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-13-gitlab-ci-sample/">一个gitlab ci文件</a></h1>
</header>
<div class="post-content">
一个golang项目典型的gitlab ci文件
image: golang:latest before_script: - export GOPROXY=https://goproxy.io,direct stages: - build - release - note build: stage: build script: - go build -o dt-release artifacts: paths: - .
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-12 itemprop="datePublished">August 12, 2021</time>
</span>
in
</div>
<div class="post-tags">
<span class="tag"><a href="https://amrom66.github.io/tags/gitlab/">
#gitlab</a></span>
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-10-shell/">一个shell程序</a></h1>
</header>
<div class="post-content">
一个简单的shell程序: app.sh
#!/bin/bash action=$1 version=$2 app_name=shuqi-public-${version} load() { file_name=shuqi-public-${version}.tar docker load -i data/${file_name} } clean() { old_container=`docker container ls | grep ${app_name}` if [ -n "${old_container}" ]; then echo "程序运行中,请先停止程序" exit; fi docker rm ${app_name} } start() { old_container=`docker container ls | grep ${app_name}` if [ -n "${old_container}" ]; then echo "程序已经在运行,请先停止" exit; fi ip=`ip a | grep -v docker0 |grep inet|grep -v 127.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-10 itemprop="datePublished">August 10, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-06-hcloud-sdk-trip/">华为云sdk踩坑</a></h1>
</header>
<div class="post-content">
简介 工作中用到了华为云,想使用华为云的sdk实现批量启动流水线,分发代码等任务,简单试用了下,发现问题太多。
问题 api区域开放问题
华为云的api调用大致有3种方式,apiexplorer在线调用、hcloud命令行调用,以及通过sdk调用。而同时华为云有区域的区分,比如华东-上海二,华东-北京一这种。api在有些区域开放了调用,但是在另一区域则不开放。举例说明:CloudPipeline(流水线)api开放区域为:上海二、上海一、北京一、北京四、广州,一共5个区域,但是CloudBuild(编译构建)api开放区域则缺少了上海一。要知道CloudBuild会依赖CloudPipeline使用,前一步的api开放了,后一步却不开放,导致根本无法使用。
文档没有示例或者示例是错误的
CloudPipeline的一个接口,ListPipelineSimpleInfo,官方给出的请求示例为:
"POST https://{endpoint}/v3/pipelines/list" 文档中根本没给出这个endpoint是什么样式的,后续经过尝试发现hcloud也会配置这个endpoint,其为cn-east-3,但是sdk调用时,其格式变成了:cloudpipeline-ext.cn-east-3.myhuaweicloud.com。样例的缺失,导致了调试成本巨大。
api混乱,缺少
举例来说,CloudPipeline流水线api,没有查看单条流水线详情的api等等
收获 经过不断的踩坑,实验出来了几个api的调用示例,贴出来以后备用。
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-06 itemprop="datePublished">August 6, 2021</time>
</span>
in
</div>
</div>
</article>
<article class="post" itemscope itemscope="" itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline"><a href="https://amrom66.github.io/2021/2021-08-05-bubble-ports/">冒号端口</a></h1>
</header>
<div class="post-content">
Linux程序监听网卡端口的时候会有各种缩写,其中有一种叫做冒号端口的写法。
现象 首先,我们看一段netstat的输出:
root@VM-0-4-debian:~# netstat -tunlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.
</div>
<div class="post-footer">
<div class="post-meta">
<span class="post-time">
<time datetime=2021-08-05 itemprop="datePublished">August 5, 2021</time>
</span>
in
</div>
</div>
</article>