1.腦裂是什么?該怎么解決淋袖?
腦裂是由于集群之間通信故障,導(dǎo)致集群中出現(xiàn)了多個(gè)Master锯梁,向多個(gè)Master寫入時(shí)即碗,出現(xiàn)了數(shù)據(jù)不同步的情況。
一般采用2個(gè)辦法:
1)采用第三方仲裁
可以是一個(gè)鎖服務(wù)涝桅,或者選舉機(jī)制等拜姿,來(lái)保證集群內(nèi)只有一個(gè)Master
2)故障組件能夠釋放掉共享資源
客戶端的路由,如果使用vip冯遂,則故障節(jié)點(diǎn)需要能夠釋放掉vip蕊肥;
如果使用proxy,需要考慮proxy自身的高可用
參考:http://blog.chinaunix.net/uid-20726500-id-5473292.html
2.cpu的用戶態(tài)與內(nèi)核態(tài)
內(nèi)核態(tài): CPU可以訪問(wèn)內(nèi)存所有數(shù)據(jù), 包括外圍設(shè)備, 例如硬盤, 網(wǎng)卡. CPU也可以將自己從一個(gè)程序切換到另一個(gè)程序
用戶態(tài): 只能受限的訪問(wèn)內(nèi)存, 且不允許訪問(wèn)外圍設(shè)備. 占用CPU的能力被剝奪, CPU資源可以被其他程序獲取
為什么要有用戶態(tài)和內(nèi)核態(tài)
由于需要限制不同的程序之間的訪問(wèn)能力, 防止他們獲取別的程序的內(nèi)存數(shù)據(jù), 或者獲取外圍設(shè)備的數(shù)據(jù), 并發(fā)送到網(wǎng)絡(luò), CPU劃分出兩個(gè)權(quán)限等級(jí) -- 用戶態(tài) 和 內(nèi)核態(tài)
3.JDK版本不對(duì)報(bào)錯(cuò)
Unsupported major.minor version 52.0/51.0 error
編寫CI編譯時(shí)經(jīng)常發(fā)生Java代碼在本地ok蛤肌,在CI環(huán)境上報(bào)上述錯(cuò)誤的情況壁却,這是由于本地開發(fā)環(huán)境與CI編譯環(huán)境JDK版本不同導(dǎo)致的。
更換JDK版本即可裸准,如在centos上:
yum -y install java-1.8.0-openjdk*
安裝后注意配置JDK對(duì)應(yīng)版本的相關(guān)環(huán)境變量
4.mvn出包命令
切入項(xiàng)目目錄:
mvn -U clean install -P allatori -Dmaven.test.skip=true
命令 | 說(shuō)明 |
---|---|
clean | 清除原來(lái)打包文件 |
install | 編譯 打包 上傳公司jar包倉(cāng)庫(kù) |
-P allatori | 代碼混淆 |
-Dmaven.test.skip=true | 跳過(guò)源碼中測(cè)試內(nèi)容 |
5.docker push鏡像
docker倉(cāng)庫(kù)一般會(huì)設(shè)置認(rèn)證展东,禁止非倉(cāng)庫(kù)授權(quán)者隨意控制倉(cāng)庫(kù)
1)登錄
docker login aaa.bbb.com(遠(yuǎn)程倉(cāng)庫(kù)網(wǎng)址)
Username: xxx
Password:***
Login Succeeded
2)給鏡像打標(biāo)簽
docker tag 111222333(鏡像id) aaa.bbb.com/lib/mysql:5.7(鏡像標(biāo)簽)
3)push 鏡像到倉(cāng)庫(kù)
docker push aaa.bbb.com/lib/mysql:5.7
6.go語(yǔ)言基礎(chǔ)類型范圍
一些數(shù)據(jù)結(jié)構(gòu)算法題,為了保證不浪費(fèi)內(nèi)存炒俱、或數(shù)字很大時(shí)需要通過(guò)范圍考慮使用類型:
類型 | 長(zhǎng)度 | 默認(rèn)值 | 范圍 |
---|---|---|---|
bool | 1 | false | true盐肃、false |
byte | 1 | 0 | |
rune | 4 | 0 | Unicode Code Point, int32 |
int, uint | 4或8 | 0 | 32 或 64 位 |
int8, uint8 | 1 | 0 | -128 ~ 127, 0 ~ 255 |
int16, uint16 | 2 | 0 | -32768 ~ 32767, 0 ~ 65535 |
int32, uint32 | 4 | 0 | -2147483648~2147483647, 0~4294967295 |
int64, uint64 | 8 | 0 | -9223372036854775808~9223372036854775807爪膊,0~18446744073709551615 |
float32 | 4 | 0.0 | |
float64 | 8 | 0.0 | |
uintptr | 4或8 | 足以存儲(chǔ)指針的 uint32 或 uint64 整數(shù) | |
array | 值類型 | ||
struct | 值類型 | ||
string | "" | UTF-8 字符串 | |
slice | nil | 引?用類型 | |
map | nil | 引?用類型 | |
channel | nil | 引?用類型 | |
interface | nil | 接? | |
function | nil | 函數(shù) |
7.存儲(chǔ)卷在宿主機(jī)上的目錄
創(chuàng)建了存儲(chǔ)卷之后,k8s的pod啟動(dòng)時(shí)可以將這些存儲(chǔ)卷掛載到容器上砸王,完成容器資源的外部持久化推盛。
但是這些存儲(chǔ)卷存放在哪里了呢?對(duì)應(yīng)宿主機(jī)的哪個(gè)路徑呢谦铃?
如下是mysql的兩個(gè)掛載目錄(/var/lib/mysql,/etc/mysql/conf,d)對(duì)應(yīng)的存儲(chǔ)卷:
如果存儲(chǔ)卷使用的是nfs
df -h|grep nfs
即可在宿主機(jī)上列出對(duì)應(yīng)的路徑耘成,切入到對(duì)應(yīng)路徑復(fù)制文件即可。
8.no space left后添加磁盤
當(dāng)磁盤不夠用時(shí)驹闰,物理添加了一塊100G的磁盤:
fdisk -l
顯示所有磁盤disk:
能夠看到這塊磁盤瘪菌,但是這塊磁盤并沒有分區(qū)、格式化不能夠使用嘹朗。
1)把磁盤分區(qū)
fdisk /dev/vdb
[root@iZ25hv9nfzgZ /]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xb162e2a0.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-524287999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-524287999, default 524287999):
Using default value 524287999
Partition 1 of type Linux and of size 250 GiB is set
Command (m for help): wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
2)格式化為ext4格式
mkfs.ext4 /dev/vdb
[root@iZ25hv9nfzgZ /]# mkfs.ext4 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
16384000 inodes, 65536000 blocks
3276800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2000 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
3)磁盤分區(qū)格式化后可以使用了师妙,掛載到使用目錄(這里是/home)即可。
mount /dev/vdb /home
4)掛載記錄寫入fstab文件
echo '/dev/vdb /mydata ext4 defaults 0 0' >> /etc/fstab
5)查看
parted /dev/vdb
print list
其中Disk Flags下面的表格為對(duì)應(yīng)磁盤的具體分區(qū)
9.安裝docker-compose
docker-compose用于在一臺(tái)宿主機(jī)上快速部署一組docker服務(wù)骡显。
1)
yum -y install epel-release
2)安裝python-pip包
yum -y install python-pip
3)對(duì)安裝好的pip進(jìn)行升級(jí)
pip install --upgrade pip
查看
pip -V
4)安裝docker-compose
pip --default-timeout=200 install -U docker-compose
查看
docker-compose -version
10.syslog日志標(biāo)準(zhǔn)格式
syslog格式:<PRI>HEADER MESSAGE
syslog的消息長(zhǎng)度:不超過(guò)1024疆栏。
syslog格式舉例:<15>Jul 10 12:00:00 192.168.1.1 SyslogGen MESSAGE
格式說(shuō)明:
PRI
即Priority(優(yōu)先級(jí)),有效值范圍為0 - 191惫谤。不能有空格壁顶、數(shù)字前也不能補(bǔ)0。
合法的形式如:<15>溜歪。
PRI值包含兩部分信息:Facility和Level若专。
Facility值用于判斷哪個(gè)程序產(chǎn)生了日志信息。
Level值用于判斷嚴(yán)重等級(jí)蝴猪。
計(jì)算機(jī)方法:
PRI = Facility * 8 + Level调衰。
Facility = PRI / 8;
Level = PRI % 8自阱;
Facility可選值為:
0 kernel messages
1 user-level messages
2 mail system
3 system daemons
4 security/authorization messages
5 messages generated internally by syslogd
6 line printer subsystem
7 network news subsystem
8 UUCP subsystem
9 clock daemon
10 security/authorization messages
11 FTP daemon
12 NTP subsystem
13 log audit
14 log alert
15 clock daemon
16 local use 0 (local0)
17 local use 1 (local1)
18 local use 2 (local2)
19 local use 3 (local3)
20 local use 4 (local4)
21 local use 5 (local5)
22 local use 6 (local6)
23 local use 7 (local7)
Level可選值為:
0 Emergency: system is unusable
1 Alert: action must be taken immediately
2 Critical: critical conditions
3 Error: error conditions
4 Warning: warning conditions
5 Notice: normal but significant condition
6 Informational: informational messages
7 Debug: debug-level messages
HEADER
HEAD包含兩部分信息:TIMESTAMP和HOSTNAME嚎莉。
TIMESTAMP為時(shí)間值,格式為:Mmm dd hh:mm:ss沛豌。表示月日時(shí)分秒趋箩。
HOSTNAME為主機(jī)IP地址或主機(jī)名。
注意:TIMESTAMP和HOSTNAME后都必須跟一個(gè)空格加派。
MESSAGE
MESSAGE包含兩部分信息:TAG和CONTENT叫确。
TAG為產(chǎn)生消息的程序或進(jìn)程名稱。為長(zhǎng)度不超過(guò)32的字母數(shù)字字符串芍锦。
CONTENT為信息的詳細(xì)內(nèi)容竹勉。
注意:TAG后的任何一個(gè)非字母數(shù)字字符都會(huì)表示TAG結(jié)束且CONTENT開始。
一般TAG結(jié)束的字符為左大括號(hào)([)或分號(hào)(;)或空格娄琉。
11.yum安裝nodejs
配置好基本yum源次乓、dns后
# 4.x版本
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
# 5.x版本
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
# 6.x版本
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
yum -y install nodejs
node -v
npm -v
12.centos7 yum安裝nginx
vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
yum -y install nginx
修改配置:
vim /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
#一個(gè)端口 下 開啟多個(gè)項(xiàng)目
server {
listen 80;
server_name 10.155.200.7;
location /aaa
{
alias /home/test_nginx/aaa;
index index.html index.php index.htm;
}
location /bbb
{
alias /home/test_nginx/bbb;
index index.html index.php index.htm;
}
}
# 開啟第二個(gè)端口
server {
listen 8080;
server_name 10.155.200.7;
location /aaa
{
alias /home/test_nginx/aaa;
index index.html index.php index.htm;
}
location /bbb
{
alias /home/test_nginx/bbb;
index index.html index.php index.htm;
}
}
}
配置詳解:
#運(yùn)行用戶
user nobody;
#啟動(dòng)進(jìn)程,通常設(shè)置成和cpu的數(shù)量相等
worker_processes 1;
#全局錯(cuò)誤日志及PID文件
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#工作模式及連接數(shù)上限
events {
#epoll是多路復(fù)用IO(I/O Multiplexing)中的一種方式,
#僅用于linux2.6以上內(nèi)核,可以大大提高nginx的性能
use epoll;
#單個(gè)后臺(tái)worker process進(jìn)程的最大并發(fā)鏈接數(shù)
worker_connections 1024;
# 并發(fā)總數(shù)是 worker_processes 和 worker_connections 的乘積
# 即 max_clients = worker_processes * worker_connections
# 在設(shè)置了反向代理的情況下吓歇,max_clients = worker_processes * worker_connections / 4 為什么
# 為什么上面反向代理要除以4,應(yīng)該說(shuō)是一個(gè)經(jīng)驗(yàn)值
# 根據(jù)以上條件票腰,正常情況下的Nginx Server可以應(yīng)付的最大連接數(shù)為:4 * 8000 = 32000
# worker_connections 值的設(shè)置跟物理內(nèi)存大小有關(guān)
# 因?yàn)椴l(fā)受IO約束照瘾,max_clients的值須小于系統(tǒng)可以打開的最大文件數(shù)
# 而系統(tǒng)可以打開的最大文件數(shù)和內(nèi)存大小成正比,一般1GB內(nèi)存的機(jī)器上可以打開的文件數(shù)大約是10萬(wàn)左右
# 我們來(lái)看看360M內(nèi)存的VPS可以打開的文件句柄數(shù)是多少:
# $ cat /proc/sys/fs/file-max
# 輸出 34336
# 32000 < 34336丧慈,即并發(fā)連接總數(shù)小于系統(tǒng)可以打開的文件句柄總數(shù),這樣就在操作系統(tǒng)可以承受的范圍之內(nèi)
# 所以主卫,worker_connections 的值需根據(jù) worker_processes 進(jìn)程數(shù)目和系統(tǒng)可以打開的最大文件總數(shù)進(jìn)行適當(dāng)?shù)剡M(jìn)行設(shè)置
# 使得并發(fā)總數(shù)小于操作系統(tǒng)可以打開的最大文件數(shù)目
# 其實(shí)質(zhì)也就是根據(jù)主機(jī)的物理CPU和內(nèi)存進(jìn)行配置
# 當(dāng)然逃默,理論上的并發(fā)總數(shù)可能會(huì)和實(shí)際有所偏差,因?yàn)橹鳈C(jī)還有其他的工作進(jìn)程需要消耗系統(tǒng)資源簇搅。
# ulimit -SHn 65535
}
http {
#設(shè)定mime類型,類型由mime.type文件定義
include mime.types;
default_type application/octet-stream;
#設(shè)定日志格式
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
#sendfile 指令指定 nginx 是否調(diào)用 sendfile 函數(shù)(zero copy 方式)來(lái)輸出文件完域,
#對(duì)于普通應(yīng)用,必須設(shè)為 on,
#如果用來(lái)進(jìn)行下載等應(yīng)用磁盤IO重負(fù)載應(yīng)用瘩将,可設(shè)置為 off吟税,
#以平衡磁盤與網(wǎng)絡(luò)I/O處理速度,降低系統(tǒng)的uptime.
sendfile on;
#tcp_nopush on;
#連接超時(shí)時(shí)間
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
#開啟gzip壓縮
gzip on;
gzip_disable "MSIE [1-6].";
#設(shè)定請(qǐng)求緩沖
client_header_buffer_size 128k;
large_client_header_buffers 4 128k;
#設(shè)定虛擬主機(jī)配置
server {
#偵聽80端口
listen 80;
#定義使用 www.nginx.cn訪問(wèn)
server_name www.nginx.cn;
#定義服務(wù)器的默認(rèn)網(wǎng)站根目錄位置
root html;
#設(shè)定本虛擬主機(jī)的訪問(wèn)日志
access_log logs/nginx.access.log main;
#默認(rèn)請(qǐng)求
location / {
#定義首頁(yè)索引文件的名稱
index index.php index.html index.htm;
}
# 定義錯(cuò)誤提示頁(yè)面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
#靜態(tài)文件姿现,nginx自己處理
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
#過(guò)期30天肠仪,靜態(tài)文件不怎么更新,過(guò)期可以設(shè)大一點(diǎn)备典,
#如果頻繁更新异旧,則可以設(shè)置得小一點(diǎn)。
expires 30d;
}
#PHP 腳本請(qǐng)求全部轉(zhuǎn)發(fā)到 FastCGI處理. 使用FastCGI默認(rèn)配置.
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#禁止訪問(wèn) .htxxx 文件
location ~ /.ht {
deny all;
}
}
}
13.解決gem install sass提佣、compass 沒有資源問(wèn)題
yum -y install gcc
compass安裝需要gcc
yum -y install ruby ruby-devel
查看gem源gem source list
ping rubygems.org
發(fā)現(xiàn)ping不通吮蛹,我們不能使用默認(rèn)的gem源刪除原gem源
gem source --remove https://rubygems.org/
添加新gem源(注意網(wǎng)址,原網(wǎng)址后綴為org)
gem source -a http://gems.ruby-china.com
安裝sass拌屏、compass
gem install sass compass
14. npm install報(bào)錯(cuò)tar.unpack unzip error
npm設(shè)置為淘寶源
npm config set registry https://registry.npm.taobao.org
測(cè)試npm源
npm config get registry
清除緩存
npm cache clean
重新執(zhí)行
npm install
輸出debug日志
npm install -verbose
15. smbclient安裝使用
安裝
yum -y install samba-client
語(yǔ)法
smbclient [網(wǎng)絡(luò)資源][密碼][-EhLN][-B<IP地址>][-d<排錯(cuò)層級(jí)>][-i<范圍>][-I<IP地址>][-l<記錄文件>] [-M<NetBIOS名稱>][-n<NetBIOS名稱>][-O<連接槽選項(xiàng)>][-p<TCP連接端口>][-R<名稱解析順序>][-s<目錄>][-t<服務(wù)器字碼>][-T<tar選項(xiàng)>][-U<用戶名稱>][-W<工作群組>]
參數(shù)說(shuō)明:
[網(wǎng)絡(luò)資源] [網(wǎng)絡(luò)資源]的格式為//服務(wù)器名稱/資源分享名稱潮针。
[密碼] 輸入存取網(wǎng)絡(luò)資源所需的密碼。
-B<IP地址> 傳送廣播數(shù)據(jù)包時(shí)所用的IP地址倚喂。
-d<排錯(cuò)層級(jí)> 指定記錄文件所記載事件的詳細(xì)程度每篷。
-E 將信息送到標(biāo)準(zhǔn)錯(cuò)誤輸出設(shè)備。
-h 顯示幫助务唐。
-i<范圍> 設(shè)置NetBIOS名稱范圍雳攘。
-I<IP地址> 指定服務(wù)器的IP地址。
-l<記錄文件> 指定記錄文件的名稱枫笛。
-L 顯示服務(wù)器端所分享出來(lái)的所有資源吨灭。
-M<NetBIOS名稱> 可利用WinPopup協(xié)議,將信息送給選項(xiàng)中所指定的主機(jī)刑巧。
-n<NetBIOS名稱> 指定用戶端所要使用的NetBIOS名稱喧兄。
-N 不用詢問(wèn)密碼无畔。
-O<連接槽選項(xiàng)> 設(shè)置用戶端TCP連接槽的選項(xiàng)。
-p<TCP連接端口> 指定服務(wù)器端TCP連接端口編號(hào)吠冤。
-R<名稱解析順序> 設(shè)置NetBIOS名稱解析的順序浑彰。
-s<目錄> 指定smb.conf所在的目錄。
-t<服務(wù)器字碼> 設(shè)置用何種字符碼來(lái)解析服務(wù)器端的文件名稱拯辙。
-T<tar選項(xiàng)> 備份服務(wù)器端分享的全部文件郭变,并打包成tar格式的文件。
-U<用戶名稱> 指定用戶名稱涯保。
-W<工作群組> 指定工作群組名稱诉濒。
場(chǎng)景例子:
下載文件
smbclient //IP/自己部門 -c "get \\自己部門下文件路徑" -U $smb_user%$smb_passwd -W 工作組名稱
上傳文件
smbclient //IP/自己部門 -c "put \\自己部門下文件路徑" -U $smb_user%$smb_passwd -W 工作組名稱
創(chuàng)建文件夾
smbclient //IP/自己部門 -c "mkdir \\自己部門下文件路徑" -U $smb_user%$smb_passwd -W 工作組名稱
16.standard_init_linux.go:178: exec user process caused “no such file or directory”
宿主機(jī)centos,docker內(nèi)系統(tǒng)alpine夕春,做鏡像未荒,啟動(dòng)后,docker logs 發(fā)現(xiàn)報(bào)錯(cuò):
standard_init_linux.go:178: exec user process caused “no such file or directory”
1.編碼問(wèn)題及志,cat -v xxx.sh 查看發(fā)現(xiàn)存在windows亂碼片排,vim :set ff=unix修改編碼(或下載dos2uinx,find ./ -type f | xargs -i dos2unix {})
2.sharp bang問(wèn)題速侈,腳本首行尋找二進(jìn)制文件找不到
17.fluentd內(nèi)置插件record_transformer Filter Plugin
格式
<filter foo.bar>
@type record_transformer
enable_ruby
<record>
avg ${record["total"] / record["count"]}
</record>
</filter>
record標(biāo)簽內(nèi)的例子:
jsonized_record ${record.to_json}
avg ${record["total"] / record["count"]}
formatted_time ${time.strftime('%Y-%m-%dT%H:%M:%S%z')}
escaped_tag ${tag.gsub('.', '-')}
last_tag ${tag_parts.last}
foo_${record["key"]} bar_${record["value"]}
nested_value ${record["payload"]["key"]}
18.tr命令
換行符改為空格
tr '\n' ' '
asd 改為 abc
tr 'asd' 'abc'
統(tǒng)一改為大寫
tr [a-z] [A-Z]
統(tǒng)一改為小寫
tr [A-Z] [a-z]
把數(shù)字0-9換為a-j
tr [0-9] [a-j]
刪除換行符 制表符
tr -d '\n'
tr -d '\t'
刪除字符asd
tr -d 'asd'
刪除空行
tr -s '\n'
刪除windows文件造成的^M字符
tr -d '\r'
19.linux 給history添加時(shí)間
echo "HISTFILESIZE=2000" >> /etc/bashrc && echo "HISTSIZE=2000" >> /etc/bashrc && echo 'HISTTIMEFORMAT="%Y%m%d %T "'>> /etc/bashrc && export HISTTIMEFORMAT
重新登錄生效
之前的記錄都為當(dāng)前時(shí)間率寡,之后的記錄會(huì)是正常時(shí)間。
20.fluentd在線正則表達(dá)式測(cè)試網(wǎng)站
正則表達(dá)式測(cè)試:http://fluentular.herokuapp.com
時(shí)間表達(dá)式規(guī)則文檔:https://docs.ruby-lang.org/en/2.2.0/Time.html#method-i-strptime
21.安裝虛擬機(jī)
直接使用VMware的ISO鏡像安裝它的操作系統(tǒng)倚搬,再使用客戶端控制創(chuàng)建虛擬機(jī)勇劣。
VMware ESXI 6.5安裝教程
22.ISODATE
名詞解釋:
格林尼治標(biāo)準(zhǔn)時(shí)間(GMT,舊譯“格林威治平均時(shí)間”或“[格林威治標(biāo)準(zhǔn)時(shí)間]是指位于倫敦郊區(qū)的皇家[格林尼治天文臺(tái)]被定義在通過(guò)那里的經(jīng)線潭枣。
協(xié)調(diào)世界時(shí)(UTC) 英文:Coordinated Universal Time 比默,別稱:世界統(tǒng)一時(shí)間,世界標(biāo)準(zhǔn)時(shí)間國(guó)際協(xié)調(diào)時(shí)間盆犁, 協(xié)調(diào)世界時(shí)命咐,又稱世界統(tǒng)一時(shí)間,世界標(biāo)準(zhǔn)時(shí)間谐岁,國(guó)際協(xié)調(diào)時(shí)間醋奠,簡(jiǎn)稱UTC。它從英文“Coordinated Universal Time”/法文“Temps Universel Cordonné”而來(lái)伊佃。
GMT(Greenwish Mean Time 格林威治平時(shí))窜司,這是UTC的民間名稱。GMT=UTC航揉。
ISODATE
格式 YYYY-MM-DDTHH:mm:ss.sssZ
示例 2019-01-09T05:01:13.000Z
2019-01-09T05:01:13.000+08:00
模型 | 說(shuō)明 |
---|---|
YYYY | is the decimal digits of the year 0000 to 9999 in the Gregorian calendar. |
- | "-" (hyphen) appears literally twice in the string. |
MM | is the month of the year from 01 (January) to 12 (December). |
DD | is the day of the month from 01 to 31. |
T | 時(shí)間元素起始標(biāo)志塞祈,"T" appears literally in the string, to indicate the beginning of the time element. |
HH | is the number of complete hours that have passed since midnight as two decimal digits from 00 to 24. |
: | ":" (colon) appears literally twice in the string. |
mm | is the number of complete minutes since the start of the hour as two decimal digits from 00 to 59. |
ss | is the number of complete seconds since the start of the minute as two decimal digits from 00 to 59. |
. | "." (dot) appears literally in the string. |
sss | is the number of complete milliseconds since the start of the second as three decimal digits. |
Z | 時(shí)區(qū)偏移,“Z”表示(UTC)或時(shí)間表達(dá)式+08:00等帅涂,is the time zone offset specified as "Z" (for UTC) or either "+" or "-" followed by a time expression HH:mm |
23.fluentd 日志丟失议薪、日志去重
https://blog.csdn.net/jj_tyro/article/details/79607502
24.制作yum repo文件
安裝createrepo
yum install createrepo -y
制作repodate文件夾
createrepo -pdo /var/cache/yum/local /var/cache/yum/local/
25.kubelet已經(jīng)集成了cadvisor用于監(jiān)控主機(jī)上的容器尤蛮,可以查看相關(guān)監(jiān)控記錄
通過(guò)訪問(wèn):http://<host_ip>:4194
docker update
當(dāng)容器啟動(dòng)時(shí)忘記添加重啟策略時(shí)
docker update --restart=always 9ca2ab8d9a58
docker update文檔
26.elasticsearch導(dǎo)出導(dǎo)入數(shù)據(jù)
安裝elasticsearch-dump
yum -y install git
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
yum -y install nodejs
git clone https://github.com/taskrabbit/elasticsearch-dump.git
cd elasticsearch-dump
npm install elasticdump -g
把原始索引的mapping結(jié)構(gòu)和數(shù)據(jù)導(dǎo)出
elasticdump --input=http://192.168.103.99:9200/ --output=/home/backup_es/cmdb_dump-mapping.json --all=true --type=mapping
elasticdump --input=http://192.168.103.99:9200/ --output=/home/backup_es/cmdb_dump.json --all=true --type=data
mapping結(jié)構(gòu)和數(shù)據(jù)導(dǎo)入新的cluster節(jié)點(diǎn)
elasticdump --input=/home/backup_es/cmdb_dump-mapping.json --output=http://10.155.203.182:9200/ --bulk=true
elasticdump --input=/home/backup_es/cmdb_dump.json --output=http://10.155.203.182:9200/ --bulk=true
27.linux 進(jìn)程文件夾
ll /proc/PID
cwd符號(hào)鏈接的是進(jìn)程運(yùn)行目錄;
exe符號(hào)連接就是執(zhí)行程序的絕對(duì)路徑斯议;
cmdline就是程序運(yùn)行時(shí)輸入的命令行命令产捞;
environ記錄了進(jìn)程運(yùn)行時(shí)的環(huán)境變量;
fd目錄下是進(jìn)程打開或使用的文件的符號(hào)連接哼御。
28.url和uri區(qū)別
“URI可以分為URL,URN或同時(shí)具備locators 和names特性的一個(gè)東西坯临。URN作用就好像一個(gè)人的名字,URL就像一個(gè)人的地址恋昼。換句話說(shuō):URN確定了東西的身份尿扯,URL提供了找到它的方式⊙娴瘢”
29.linux上查看文件stat命令
stat命令能夠查看到一個(gè)文件的訪問(wèn)時(shí)間、修改時(shí)間芳杏、狀態(tài)修改時(shí)間等矩屁,但不能獲取文件的創(chuàng)建時(shí)間。
參考文章:https://blog.csdn.net/yexiangcsdn/article/details/81012732
30.linux上查看文件的創(chuàng)建時(shí)間
如果文件系統(tǒng)是ext4類型時(shí)氯哮,可以查看到文件的創(chuàng)建時(shí)間椒丧,1.通過(guò)stat命令或ls -i filename命令查看到文件的inode號(hào)瓢颅,2.找到文件所在的分區(qū)或VG df -T,3.通過(guò)debugfs -R 'stat <xxx>' /dev/xxxx
[root@mylnx06 resource]# debugfs -R 'stat <13>' /dev/sdb1
debugfs 1.42.9 (28-Dec-2013)
Inode: 13 Type: regular Mode: 0644 Flags: 0x80000
Generation: 3202520017 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 0
File ACL: 0 Directory ACL: 0
Links: 0 Blockcount: 0
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5c75e766:924da674 -- Wed Feb 27 09:27:02 2019
atime: 0x5c75e757:dfe24bb0 -- Wed Feb 27 09:26:47 2019
mtime: 0x5c75e72b:c6a80080 -- Wed Feb 27 09:26:03 2019
crtime: 0x5c75e72b:c6a80080 -- Wed Feb 27 09:26:03 2019
dtime: 0x5c75e766 -- Wed Feb 27 09:27:02 2019
Size of extra inode fields: 28
EXTENTS:
31.docker的overlay2文件夾下面文件很大
使用命令docker system df -v 查看鏡像、容器烁峭、掛載卷的大小
[root@localhost docker]# docker system df -v
Images space usage:
REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
registry.cn-hangzhou.aliyuncs.com/xuxiang/centos aegis_smoke 3ca8c493ec25 12 months ago 614.8 MB 0 B 614.8 MB 1
registry.cn-hangzhou.aliyuncs.com/xuxiang/sas sql2 1659fbec2cc6 14 months ago 3.18 GB 2.869 GB 311 MB 2
registry.cn-hangzhou.aliyuncs.com/xuxiang/sas sql 3aa054ca03e1 14 months ago 2.869 GB 2.869 GB 0 B 1
registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun latest 294e6391833a 20 months ago 2.924 GB 0 B 2.924 GB 6
docker.io/dijedodol/simple-socks5-server latest 91218fcc1a71 2 years ago 115.9 MB 0 B 115.9 MB 0
cgminer_testv1.3 latest 1de49022432d 2 years ago 421.8 MB 0 B 421.8 MB 0
redis_testv1.3 latest 450d963b34cb 2 years ago 182.9 MB 0 B 182.9 MB 2
registry.cn-hangzhou.aliyuncs.com/xuxiang/dvwa latest 119d37316de7 2 years ago 534.9 MB 0 B 534.9 MB 3
Containers space usage:
CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES
84dd949fa45f registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun "/start.sh" 0 14.6 GB 13 days ago Up 13 days zuozhu_de_gongjiji_92_cs3
48e0b72a51b7 registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun "/start.sh" 0 13.1 GB 13 days ago Up 13 days zuozhu_de_gongjiji_91_cs3
a7eab0f2e449 registry.cn-hangzhou.aliyuncs.com/xuxiang/sas:sql2 "/start.sh" 0 1.08 MB 13 days ago Up 13 days zuozhu_de_baji_91_cs3
2b8e374ced54 registry.cn-hangzhou.aliyuncs.com/xuxiang/dvwa "/run.sh" 2 646 kB 13 days ago Up 13 days dvwa_cs3test
cd4e6d9fce41 registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun "/start.sh" 0 50.5 MB 13 days ago Up 13 days inner_kali_yundun_cs3test
f5e664e1ac80 registry.cn-hangzhou.aliyuncs.com/xuxiang/sas:sql "/start.sh" 0 95.6 MB 13 days ago Up 13 days sas_cs3test
a76ea60d57ef registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun "/start.sh" 0 50.5 MB 13 days ago Up 13 days aegis_kali_yunduncs3test
6412d873190f registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun "/start.sh" 0 50.5 MB 13 days ago Up 13 days kali_yundun_cs3test
575a39797686 3ca8c493ec25 "/home/start.sh" 0 189 MB 2 months ago Up 3 weeks aegis_ym_64
67d51df47ad2 450d963b34cb "docker-entrypoint..." 1 192 B 2 months ago Up 3 weeks redis_ym_63
34d997610cb2 registry.cn-hangzhou.aliyuncs.com/xuxiang/kali_yundun "/start.sh" 0 449 MB 2 months ago Up 3 weeks kali_ym_61
ef21bf1e3d75 registry.cn-hangzhou.aliyuncs.com/xuxiang/sas:sql2 "/start.sh" 0 3.74 MB 2 months ago Up 3 weeks sas_ym_62
31eb8824942d registry.cn-hangzhou.aliyuncs.com/xuxiang/dvwa "/run.sh" 2 1.73 MB 2 months ago Up 3 weeks dvwa_ym_61
f7c3a14fddd6 119d37316de7 "/run.sh" 2 29 GB 3 months ago Up 3 weeks smoke_jl
b7e93401d8c9 450d963b34cb "docker-entrypoint..." 1 526 B 3 months ago Up 3 weeks redis_jl
Local Volumes space usage:
VOLUME NAME LINKS SIZE
0d86d4d00339dd7138e1f1d5f8551c0f78cf317ae20a61476881fcb8fe3f3e58 1 0 B
4a76ad7814cc60581d29334084f2c7594c7d53043318d0649323282d6a58a672 1 5.109 kB
6de6125472af2d56af9e6638107551181b0f4cd28fec7e682e9132d1f0517740 1 0 B
b2b936534a991f79d531fbb8c214ba55175c51aacf6e7009f11aadda31d9267f 1 30.43 MB
675e69ea48445a089db7a4dcf0cf381da2bd7272661a7c448c23bb2abb0f4310 1 5.109 kB
0ae662cea0e22f1078761c92d4402238a86a5fc6b3a0b50c126b45b5fdaa866b 1 30.43 MB
5f55cb5eb1a10046d2ce4d60d1efe839a1049afd5c14e540e0e93f512919df72 1 30.43 MB
9bd5dfd2d38df43483a8ab289392804d35a6c996ffb70402b65b6d6de5712b52 1 5.109 kB
找到占用磁盤較大的資源,然后清除掉即可秕铛。
32.shell 正則表達(dá)式约郁,提取匹配內(nèi)容
str='master 7ecbf3f [origin/master: ahead 8, behind 1] local'
#方法一
grep -Po '\[\K[^]]+' <<<$str ,這種方法可以提取多個(gè)但两,下面2種方法提取的是第一個(gè)[到最后一個(gè)]之前的字符鬓梅。
#方法二
sed 's/[^[]\+\[//;s/].*//' <<<$str
#方法三
awk -F'[][]' '{print $2}' <<<$str
33.yum報(bào)錯(cuò)error: cannot open Packages database in /var/lib/rpm
配完dns更換完yum源后,使用yum clean all && yum makecache
時(shí)如下錯(cuò)誤谨湘。
rpmdb: Thread/process 11197/140701458409216 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
解決辦法:
rm -rf /var/lib/rpm/__db*
34.spark sql 字符替換
在寫spark sql時(shí)绽快,輸出的一個(gè)字段包含了字符串,導(dǎo)致整體結(jié)構(gòu)出錯(cuò)紧阔。
于是使用字符替換函數(shù)坊罢,將雙引號(hào)替換為單引號(hào)
regexp_replace(postdata, '"', '\''),
sql中單引號(hào)與雙引號(hào)轉(zhuǎn)義如下:
mysql> SELECT 'hello', '"hello"', '""hello""', 'hel''lo', '\'hello';
+-------+---------+-----------+--------+--------+
| hello | "hello" | ""hello"" | hel'lo | 'hello |
+-------+---------+-----------+--------+--------+
mysql> SELECT "hello", "'hello'", "''hello''", "hel""lo", "\"hello";
+-------+---------+-----------+--------+--------+
| hello | 'hello' | ''hello'' | hel"lo | "hello |
+-------+---------+-----------+--------+--------+
mysql> SELECT 'This\nIs\nFour\nLines';
+--------------------+
| This
Is
Four
Lines |
+--------------------+
mysql> SELECT 'disappearing\ backslash';
+------------------------+
| disappearing backslash |
+------------------------+
35.遠(yuǎn)程git倉(cāng)庫(kù)git merge錯(cuò)誤如何回退
方法一:
- 1.從合入錯(cuò)誤merge之前的commit拉出一個(gè)branch如tmp分支。
- 2.刪掉merge錯(cuò)了的分支擅耽。
- 3.從tmp分支再拉一個(gè)原名稱的分支活孩。
方法二:本地命令行中
- 1.
git log
查找需要回滾到的commit號(hào) - 2.
git reset --hard <commitId>
進(jìn)行回退 - 3.
git push -f
推送到遠(yuǎn)程倉(cāng)庫(kù)
36.類似jenkins,ci過(guò)程中更新分支代碼進(jìn)行編譯的git處理乖仇。
- 1.確定倉(cāng)庫(kù)地址之前诱鞠,首先需要當(dāng)前工作目錄是否是一個(gè)Git倉(cāng)庫(kù)
root@localhost> git rev-parse --is-inside-work-tree
true
- 2.確認(rèn)當(dāng)前工作目錄的倉(cāng)庫(kù)地址
root@localhost> git config --list|grep -F "remote.origin.url"`
remote.origin.url=ssh://git@gitlab.xxx/chentairan/git-learn.git
- 3.? 如果需要直接設(shè)置倉(cāng)庫(kù)地址
root@localhost> git config remote.origin.url ssh://git@gitlab.xxx/chentairan/git-learn.git
- 4.獲取指定遠(yuǎn)程分支
chentairan@localhost ~/t/git-learn> git fetch ssh://git@gitlab.xxx/chentairan/git-learn.git $BRANCH_NAME:refs/remotes/origin/$BRANCH_NAME
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
From ssh://gitlab.xxx/chentairan/git-learn
* [new branch] dev -> origin/dev
- 5.獲取分支的Commit ID
chentairan@localhost ~/t/git-learn> git rev-parse --verify refs/remotes/origin/$BRANCH_NAME
9e100c01201678286db5d266b8d342b0dd8a8e0d
- 6.檢出提交
chentairan@localhost ~/t/git-learn> git checkout -f 9e100c01201678286db5d266b8d342b0dd8a8e0d
- 7.去掉多余文件
chentairan@localhost ~/t/git-learn> git clean -fdx
jenkins上截取的完整git處理:
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@gitlab01.dtdream.com:SEC/DTCSC.git # timeout=10
Fetching upstream changes from git@gitlab01.dtdream.com:SEC/DTCSC.git
> git --version # timeout=10
> git fetch --tags --progress git@gitlab01.dtdream.com:SEC/DTCSC.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/release^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/release^{commit} # timeout=10
Checking out Revision da5bd1dec2add3657730a5f0b6b0be0a55c22715 (refs/remotes/origin/release)
> git config core.sparsecheckout # timeout=10
> git checkout -f da5bd1dec2add3657730a5f0b6b0be0a55c22715
Commit message: "Merge branch 'release-1029' into 'release'"
> git rev-list da5bd1dec2add3657730a5f0b6b0be0a55c22715 # timeout=10
37.添加開機(jī)啟動(dòng)腳本
方法一:通過(guò)rc.local添加
result=$(grep ipvsadm /etc/rc.d/rc.local)
if [ -z "$result" ]; then
echo "ipvsadm" >> /etc/rc.d/rc.local
echo "echo ${V_MIN_FREE_KBYTES} > /proc/sys/vm/min_free_kbytes" >> /etc/rc.d/rc.local
fi
chmod +x /etc/rc.d/rc.local
方法二:通過(guò)定時(shí)任務(wù)添加
# 移除 /etc/crontab中的 recover腳本
sed -i '/recover\.sh/d' /etc/crontab
# 添加recover腳本
echo "@reboot root /bin/bash -c '${p_recover}/recover.sh &>>/var/log/recover.log &'" >> /etc/crontab
38.shell test命令
參考:https://www.runoob.com/linux/linux-shell-test.html
test -x 文件名
測(cè)試文件是否存在并具有可執(zhí)行權(quán)限挎挖,返回0、1
39.shell ulimit命令
參考:https://www.runoob.com/linux/linux-comm-ulimit.html
ulimit為shell內(nèi)建指令航夺,可用來(lái)控制shell執(zhí)行程序的資源
40.shell set蕉朵、env、export
- set命令顯示當(dāng)前shell的變量阳掐,包括當(dāng)前用戶的變量;
- env命令顯示當(dāng)前用戶的變量;
- export命令顯示當(dāng)前導(dǎo)出成用戶變量的shell變量始衅。
參考:https://www.runoob.com/linux/linux-comm-set.html
42.windows下goland中的terminal使用git bash作為命令行工具。
Shell path中添加:
"F:\software\Git\bin\sh.exe" -login -i
41.報(bào)錯(cuò)github error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
http://www.reibang.com/p/0cfa98c5a27f
git 客戶端版本過(guò)低缭保,其使用的TLSV1和TLSV1.1 這個(gè)涉及到到所有的github.com的鏈接汛闸,在2018年2月22日以后將禁用。直接去git客戶端官網(wǎng):https://git-scm.com/downloads下載最新版本(當(dāng)前是2.16.2)艺骂,覆蓋安裝即可诸老。
43.壓力測(cè)試工具ab
如(yum -y install httpd-tools
)
[root@vic html]# ab --help
ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
-t timelimit Seconds to max. wait for responses
-b windowsize Size of TCP send/receive buffer, in bytes
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header for POSTing, eg.
'application/x-www-form-urlencoded'
Default is 'text/plain'
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. 'Apache=1234. (repeatable)
-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don't exit on socket receive errors.
-h Display usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
示例:
ab -c 10 -n 100 http://www.myvick.cn/index.php
并發(fā)10個(gè)請(qǐng)求,共100個(gè)請(qǐng)求钳恕。
44.壓力測(cè)試工具wrk
[root@localhost /]# wrk -t2 -c10 -d15 --latency http://www.baidu.com
Running 15s test @ http://www.baidu.com
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 35.64ms 1.31ms 48.59ms 79.38%
Req/Sec 138.40 13.52 151.00 89.00%
Latency Distribution
50% 35.50ms
75% 36.13ms
90% 37.09ms
99% 40.33ms
4151 requests in 15.05s, 60.83MB read
Socket errors: connect 0, read 29, write 0, timeout 0
Requests/sec: 275.72
Transfer/sec: 4.04MB
1)語(yǔ)法中的參數(shù)
-t:需要模擬的線程數(shù)
-c:需要模擬的連接數(shù)
-d:測(cè)試的持續(xù)時(shí)間
--timeout:超時(shí)的時(shí)間
--latency:顯示延遲統(tǒng)計(jì)
2)結(jié)果顯示的指標(biāo)
Latency:響應(yīng)時(shí)間
Req/Sec:每個(gè)線程每秒鐘的完成的請(qǐng)求數(shù)
Avg:平均
Max:最大
Stdev:標(biāo)準(zhǔn)差
45.16進(jìn)制字符串 到 字符串轉(zhuǎn)換
https://www.cnblogs.com/fqfanqi/p/7900758.html
46.Alpine Linux升級(jí)
Alpine Linux
Small. Simple. Secure.Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox.
Alpine Linux 是一個(gè)社區(qū)開發(fā)的面向安全應(yīng)用的輕量級(jí)Linux發(fā)行版别伏。 Alpine 的意思是“高山的”,它采用了musl libc和busybox以減小系統(tǒng)的體積和運(yùn)行時(shí)資源消耗忧额,同時(shí)還提供了自己的包管理工具apk厘肮。
### 適用環(huán)境
由于其小巧、安全睦番、簡(jiǎn)單以及功能完備的特點(diǎn)类茂,被廣泛應(yīng)用于眾多Docker容器中。我司目前使用的基礎(chǔ)鏡像均是基于該系統(tǒng)托嚣,[dockerhub](https://hub.docker.com/_/alpine)上有提供各種語(yǔ)言的基礎(chǔ)鏡像.如:`node:8-alpine`巩检、`python:3.6-alpine`,同時(shí)也可以基于alpine鏡像制作符合自己需求的基礎(chǔ)鏡像示启。
echo -e "https://mirrors.ustc.edu.cn/alpine/latest-stable/main\nhttps://mirrors.ustc.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories
apk upgrade
47.升級(jí)openssh版本
yum install -y gcc openssl-devel pam-devel zlib zlib-devel
http://www.reibang.com/p/220f7fd908b0
48.GO安裝后報(bào)錯(cuò)
windows上安裝go1.12.5.windows-amd64.msi后碴巾,執(zhí)行命令:go version
,報(bào)錯(cuò)如下:
cmd/go: unsupported GOOS/GOARCH pair windows /amd64
解決方法:
系統(tǒng)環(huán)境變量中的環(huán)境變量OS丑搔、PROCESSOR_ARCHITECTURE沒有和GOARCH厦瓢、GOOS對(duì)應(yīng)上,修改后正常啤月。
49.haproxy.cfg添加監(jiān)控頁(yè)面
frontend secure #自定義一個(gè)frontend煮仇,也可以放在listen或者backend中
bind *:9999 #監(jiān)聽的ip端口號(hào)
stats enable #開關(guān)
stats uri /admin?admin #訪問(wèn)的uri ip:8888/admin?admin
stats auth admin:admin #認(rèn)證用戶名和密碼
stats hide-version #隱藏HAProxy的版本號(hào)
stats admin if TRUE #管理界面,如果認(rèn)證成功了谎仲,可通過(guò)webui管理節(jié)點(diǎn)
stats refresh 5s #統(tǒng)計(jì)頁(yè)面自動(dòng)刷新時(shí)間
將此配置粘貼到配置文件中浙垫,并重啟即可。
50.mac 使用brew升級(jí)go版本
brew upgrade go