数据存储

Prometheus具有配置本地存储的多个标志。最重要的是:

--storage.tsdb.path:Prometheus写入数据库的位置。默认为data/。
--storage.tsdb.retention.time:何时删除旧数据。默认为15d。storage.tsdb.retention如果此标志设置为默认值以外的任何值,则覆盖。
--storage.tsdb.retention.size:[EXPERIMENTAL]要保留的最大存储块字节数。最旧的数据将首先被删除。默认为0或禁用。该标志是试验性的,将来的发行版中可能会更改。支持的单位:B,KB,MB,GB,TB,PB,EB。例如:“ 512MB”
--storage.tsdb.retention:不推荐使用storage.tsdb.retention.time。
--storage.tsdb.wal-compression:启用压缩预写日志(WAL)。根据您的数据,您可以预期WAL大小将减少一半,而额外的CPU负载却很少。该标志在2.11.0中引入,默认情况下在2.20.0中启用。请注意,一旦启用,将Prometheus降级到2.11.0以下的版本将需要删除WAL。
#For example:
./prometheus --storage.tsdb.retention.time=1d
./prometheus --storage.tsdb.retention.size=10GB

删除历史数据

默认情况下,管理时间序列的 API 是被禁用的,要启用它,我们需要在 Prometheus 的启动参数中添加--web.enable-admin-api这个参数

删除某个标签匹配的数据

$ curl -X POST -g 'http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]={instance=".*"}'

删除某个指标数据

$ curl -X POST -g 'http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]={node_load1=".*"}'

根据时间删除

$ curl -X POST -g 'http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]={node_load1=".*"}&start<2020-02-01T00:00:00Z&end=2020-02-04T00:00:00Z'

原文链接:https://blog.csdn.net/w345731923/article/details/113643866

Unable to mount CIFS share on Linux: mount error(13): Permission denied (cifs_mount failed w/return code = -13)

There are a couple of ways how to mount a CIFS/Samba share on a Linux client. However some tutorials are outdated and meanwhile completely wrong. I just ran into a (stupid) case of a wrong mount.cifs syntax:

[email protected]:~# mount -t cifs //server/Share /mnt -o rw,user=domain\myuser,password=secret
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg) 

Unfortunately, the additional output in dmesg is not helpful to figure out the problem:

[email protected]:~# dmesg
[...]
[16444886.307684] CIFS: Attempting to mount //server/Share
[16444886.307717] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[16444886.539770] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[16444886.539795] CIFS VFS: \\server Send error in SessSetup = -13
[16444886.539901] CIFS VFS: cifs_mount failed w/return code = -13

After additional try and errors (and looking up a recent share mount from the history), the problem turned out to be the user=domainmyuser syntax. This way of combining the domain/workgroup and the username is not working (anymore).

Note: Both user= and username= are accepted in the options.

Instead use:

[email protected]:~# mount -t cifs "//server/Share" /mnt -o "user=myuser,password=secret,workgroup=DOMAIN"
[email protected]:~# ll /mnt/
total 0
drwxr-xr-x 2 root root 0 Sep  1  2020 _Archiv
drwxr-xr-x 2 root root 0 Aug  9 12:10 Client
[..]

This way it worked.

Of course the password should not be used on the command line, so for the final (and automatic) mount of the share use the following entry in /etc/fstab:

[email protected]:~# cat /etc/fstab
[...]
# Mount CIFS share from server
//server/Share /mnt cifs rw,relatime,vers=3.1.1,credentials=/etc/samba/servershare.conf,uid=0 0 0

Where /etc/samba/servershare.conf contains the credentials:

[email protected]:~# cat /etc/samba/servershare.conf
user=myuser
password=secret
domain=DOMAIN

 我以前使用清单安装过nginx-ingress。我删除了它创建的命名空间,以及文档中提到的clusterrole和clusterrolebinding,但这并没有删除安装在清单中的ValidatingWebhookConfiguration,但在默认使用helm时没有删除。

一、之前已经安装ingress然后重新部署Ingress

[[email protected] 05]# kubectl apply -f  nginx-ingress.yaml 
Warning: networking.k8s.io/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
Error from server (InternalError): error when creating "nginx-ingress.yaml": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": Post "https://ingress-nginx-controller-admision.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s": service "ingress-nginx-controller-admission" not found

二、删除ValidatingWebhookConfiguration

[[email protected] 05]# kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
validatingwebhookconfiguration.admissionregistration.k8s.io "ingress-nginx-admission" deleted

三、重新执行部署nginx-ingress服务
[[email protected] 05]# kubectl apply -f nginx-ingress.yaml

kubectl命令补全工具的安装。

1:安装bash-completion:

yum install -y bash-completion 
source /usr/share/bash-completion/bash_completion

2:应用kubectl的completion到系统环境:

source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc