Kamafeel

求其上,得其中;求其中,得其下,求其下,必败


  • 首页

  • 归档

docker安装

发表于 2020-12-10 | 更新于 2022-02-16 | 分类于 Docker

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

关闭 swap

swapoff -a && sed -i ‘/ swap / s/^/#/‘ /etc/fstab

##关闭SElinux功能 ##
vi /etc/selinux/config
将文件中的SELINUX=enforcing改为SELINUX=disabled

调整系统限制

vim /etc/security/limits.conf

  • soft nofile 1024000
  • hard nofile 1024000
  • soft memlock unlimited
  • hard memlock unlimited
    root soft nofile 1024000
    root hard nofile 1024000
    root soft memlock unlimited

修改docker镜像为国内的

/etc/docker/daemon.json

{ “data-root”: “/docker”,
“registry-mirrors”: [“https://we7bfy29.mirror.aliyuncs.com"]
}

postGis安装和验证

发表于 2020-11-24 | 更新于 2021-11-18 | 分类于 数据库 , PostgreSQL

PostGIS空间扩展

CREATE EXTENSION postgis;

PostGIS函数来确认是否在数据库中安装了PostGIS扩展插件

SELECT postgis_full_version();

K8S pod目录挂载

发表于 2020-11-20 | 分类于 K8S

本地目录挂载

nfs模式

https://www.jianshu.com/p/1f5521ba96dd

docker宿主机目录挂载

发表于 2020-11-20 | 分类于 Docker

-v 模式

docker run -it -v /home/dock/Downloads:/usr/Downloads ubuntu64 /bin/bash
通过-v参数,冒号前为宿主机目录,必须为绝对路径,冒号后为镜像内挂载的路径

数据卷模式

https://www.jianshu.com/p/889885e75de8

K8S安装-minikube

发表于 2020-11-16 | 更新于 2021-05-21 | 分类于 K8S

安装 kubectl

Kubectl 是 Kubernetes 自带的命令行工具

1.查询版本
https://storage.googleapis.com/kubernetes-release/release/stable.txt

2.下载(自行替换版本)
https://storage.googleapis.com/kubernetes-release/release/v1.18.4/bin/linux/amd64/kubectl

3.安装
赋可执行权限

1
chmod +x ./kubectl
移动到系统PATH中
1
sudo mv ./kubectl /usr/local/bin/kubectl

前期准备

1.各类参数调整

1
2
3
4
yum install conntrack
sysctl -w net.bridge.bridge-nf-call-iptables=1
echo "net.bridge.bridge-f-call-iptables=1" > /etc/sysctl.d/k8s.conf
swapoff -a && sed -i '/ swap / s/^/#/' /etc/fstab

2.docker安装源(保存为shell执行)

1
2
3
4
5
6
7
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://youraddr.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

3.K8S安装源(保存为shell执行)

1
2
3
4
5
6
7
8
9

cat >> /etc/yum.repos.d/kubernetes.repo <<EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
EOF

安装

1.下载minikube

1
curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.11.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

2.安装minikube
使用非virtualbox驱动模式
minikube start –driver=none

3.验证安装状态
minikube status

4.后续启动minikube
minikube start

Kubernetes Dashboard安装

1.下载部署文档

1
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml

2.检查docker images是否下载成功
docker images
如果镜像无法下载,k8s.gcr.io 替换为了 reg.qiniu.com/k8s 或者使用代理

3.修改DashBoard的Service端口暴露模式为NodePort

1
kubectl edit service kubernetes-dashboard -n kubernetes-dashboard
1
2
spec:
type: NodePort

4.创建Service Account 及 ClusterRoleBinding
保存下面信息为auth.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
1
kubectl apply -f auth.yaml

5.查看部署端口

1
kubectl get svc -A

6.访问
获取token

1
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

K8S yaml说明

发表于 2020-11-16 | 分类于 K8S
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

apiVersion: apps/v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Deployment # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
name: demo # 资源的名字,在同一个namespace中必须唯一
namespace: default # 部署在哪个namespace中
labels: # 设定资源的标签
app: demo
version: stable
spec: # 资源规范字段
replicas: 1 # 声明副本数目
revisionHistoryLimit: 3 # 保留历史版本
selector: # 选择器
matchLabels: # 匹配标签
app: demo
version: stable
strategy: # 策略
rollingUpdate: # 滚动更新
maxSurge: 30% # 最大额外可以存在的副本数,可以为百分比,也可以为整数
maxUnavailable: 30% # 示在更新过程中能够进入不可用状态的 Pod 的最大值,可以为百分比,也可以为整数
type: RollingUpdate # 滚动更新策略
template: # 模版
metadata: # 资源的元数据/属性
annotations: # 自定义注解列表
sidecar.istio.io/inject: "false" # 自定义注解名字
labels: # 设定资源的标签
app: demo
version: stable
spec: # 资源规范字段
containers:
- name: demo # 容器的名字
image: demo:v1 # 容器使用的镜像地址
imagePullPolicy: IfNotPresent # 每次Pod启动拉取镜像策略,三个选择 Always、Never、IfNotPresent
# Always,每次都检查;Never,每次都不检查(不管本地是否有);IfNotPresent,如果本地有就不检查,如果没有就拉取
resources: # 资源管理
limits: # 最大使用
cpu: 300m # CPU,1核心 = 1000m
memory: 500Mi # 内存,1G = 1000Mi
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
cpu: 100m
memory: 100Mi
livenessProbe: # pod 内部健康检查的设置
httpGet: # 通过httpget检查健康,返回200-399之间,则认为容器正常
path: /healthCheck # URI地址
port: 8080 # 端口
scheme: HTTP # 协议
# host: 127.0.0.1 # 主机地址
initialDelaySeconds: 30 # 表明第一次检测在容器启动后多长时间后开始
timeoutSeconds: 5 # 检测的超时时间
periodSeconds: 30 # 检查间隔时间
successThreshold: 1 # 成功门槛
failureThreshold: 5 # 失败门槛,连接失败5次,pod杀掉,重启一个新的pod
readinessProbe: # Pod 准备服务健康检查设置
httpGet:
path: /healthCheck
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 5
#也可以用这种方法
#exec: 执行命令的方法进行监测,如果其退出码不为0,则认为容器正常
# command:
# - cat
# - /tmp/health
#也可以用这种方法
#tcpSocket: # 通过tcpSocket检查健康
# port: number
ports:
- name: http # 名称
containerPort: 8080 # 容器开发对外的端口
protocol: TCP # 协议
imagePullSecrets: # 镜像仓库拉取密钥
- name: harbor-certification
affinity: # 亲和性调试
nodeAffinity: # 节点亲和力
requiredDuringSchedulingIgnoredDuringExecution: # pod 必须部署到满足条件的节点上
nodeSelectorTerms: # 节点满足任何一个条件就可以
- matchExpressions: # 有多个选项,则只有同时满足这些逻辑选项的节点才能运行 pod
- key: beta.kubernetes.io/arch
operator: In
values:
- amd64

Spring@Lazy和循环依赖

发表于 2020-10-30 | 分类于 Spring , 开发

@Lazy基本用途

减少spring启动时间
处理依赖循环错误
增加首次调用时间(HTTP首次请求之类)

循环依赖

很多方式可以处理,但是应该本质去解决bean之间的相互依赖。

https://www.cnblogs.com/javahr/p/13405442.html

Cassandra的使用场景

发表于 2020-10-28 | 更新于 2021-08-02 | 分类于 大数据 , Cassandra

和ES一样,写入基于LSM,但是属于无主(多主),最好写入者胜。

https://www.infoq.cn/article/etcDovQ3lCk7EiYjdlhp

Neo4j图数据库

发表于 2020-10-28 | 更新于 2021-08-02 | 分类于 数据库 , Neo4j

我们假设这样一种特殊的查询场景:找出开发商是XXX,小区绿化率大于30%,周边200米有大型超市,500米有地铁,1000米有三甲医院,2000米有升学率超过60%的高中,房价在800W以内,最近被经纪人带看次数最多的房子?

MYSQL,ES,Hbase能解决不?

待升级技能清单

发表于 2020-10-26 | 分类于 瞎扯蛋

画图的:

enterprise architect UML,时序图

visio(备选)

文档

Word
PPT

HOW

参考现有物,模仿,GOOGLE

1…101112…21

Kamafeel

204 日志
57 分类
129 标签
© 2022 Kamafeel
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Pisces v7.1.2