mysql5.5.25 自动化脚本安装

mysql5.5.25 自动化脚本安装

mysql5.5.25 自动化脚本安装 #!/bin/bash #创作日期:2013.7.26 #Mysql install directory and configuration files.****** MYSQL_DIR="/data/software" DATA_DIR="/data/mysql/3306/data" BASE_DIR="/usr/local/mysql" echo "please input mysql version:" read VERSION echo "Your mysql version is mysql-$VERSION.tar.gz" if [ -e "$MYSQL_DIR/mysql-$VERSION.tar.gz" ] then echo "Please waitting..." sleep 3 #Install mysql package dependent. yum -y install gcc gcc-c++ gcc-g77 autoconf automake openssl zlib* fiex** libxml* \ ncurses-devel libmcrypt* libtool-ltdl-devel* && \ #Install cmake. echo "The system is bing installed cmake,please waitting..." sleep 3 tar -zxvf $MYSQL_DIR/cmake-2. [Read More]

企业级监控软件zabbix搭建部署之zabbix server的安装

企业级监控软件zabbix搭建部署之zabbix server的安装

企业级监控软件zabbix搭建部署之zabbix server的安装

zabbix线上已经应用半年多了,关于zabbix在生产环境中的使用心得,以及一些经验写下来,希望让大家少走弯路,共同学习!

	环境:  
		Server:CentOS6.3_X86.64  
		Zabbix:zabbix-2.0.8.tar  
		Zabbix_agents:zabbix_agents_2.0.8.linux2_6.amd64.tar  

	服务器命名规则:  
		Zabbix-Server:192.168.100.239  
		Zabbix-Agent01:192.168.100.240
[Read More]

Kubernetest REST API

Kubernetest REST API

启动proxy ➜ _posts kubectl proxy --port=8080 Starting to serve on 127.0.0.1:8080 查看APIserver ➜ http 127.0.0.1:8080 HTTP/1.1 200 OK Content-Length: 2644 Content-Type: application/json Date: Tue, 15 Jan 2019 05:19:42 GMT { "paths": [ "/api", "/api/v1", "/apis", "/apis/", "/apis/admissionregistration.k8s.io", "/apis/admissionregistration.k8s.io/v1beta1", "/apis/apiextensions.k8s.io", "/apis/apiextensions.k8s.io/v1beta1", "/apis/apiregistration.k8s.io", "/apis/apiregistration.k8s.io/v1", "/apis/apiregistration.k8s.io/v1beta1", "/apis/apps", "/apis/apps/v1", "/apis/apps/v1beta1", "/apis/apps/v1beta2", "/apis/authentication.k8s.io", "/apis/authentication.k8s.io/v1", "/apis/authentication.k8s.io/v1beta1", "/apis/authorization.k8s.io", "/apis/authorization.k8s.io/v1", "/apis/authorization.k8s.io/v1beta1", "/apis/autoscaling", "/apis/autoscaling/v1", "/apis/autoscaling/v2beta1", "/apis/batch", "/apis/batch/v1", "/apis/batch/v1beta1", "/apis/ceph.rook.io", "/apis/ceph.rook.io/v1", "/apis/certificates.k8s.io", "/apis/certificates.k8s.io/v1beta1", "/apis/compose.docker.com", "/apis/compose.docker.com/v1beta1", "/apis/compose.docker.com/v1beta2", "/apis/events.k8s.io", "/apis/events.k8s.io/v1beta1", "/apis/extensions", "/apis/extensions/v1beta1", "/apis/networking. [Read More]

prometheus学习系列(一)

安装prometheus报错解决方法

下载源代码安装prometheus-operator的时候报错 git clone https://github.com/coreos/kube-prometheus.git 执行 kubectl apply -f manifests/ 报错 unable to recognize “manifests/0prometheus-operator-serviceMonitor.yaml”: no matches for kind “ServiceMonitor” in version “monitoring.coreos.com/v1” unable to recognize “manifests/alertmanager-alertmanager.yaml”: no matches for kind “Alertmanager” in version “monitoring.coreos.com/v1” unable to recognize "manifests/alertmanager-serviceMonitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1" unable to recognize "manifests/kube-state-metrics-serviceMonitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1" unable to recognize “manifests/node-exporter-serviceMonitor.yaml”: no matches for kind “ServiceMonitor” in version “monitoring.coreos.com/v1” unable to recognize “manifests/prometheus-prometheus. [Read More]

prometheus学习系列(三)

在minikube中安装Prometheus Operator

参考资料 GitHub - coreos/prometheus-operator: Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes git clone kube-prometheus;需要注意的是,代码已经从原来的地址迁移到这个地址 git clone https://github.com/coreos/prometheus-operator.git minikube安装部署,请参考另外一篇文章 安装 # create namespace and CRDs kubectl apply -f manifests/setup # wait for CRD creation to complete until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done # create monitoring components kubectl apply -f manifests/ 查看 ➜ kube-prometheus git:(master) ✗ k get pods -n monitoring NAME READY STATUS RESTARTS AGE alertmanager-main-0 2/2 Running 4 104m alertmanager-main-1 2/2 Running 4 104m alertmanager-main-2 2/2 Running 4 104m grafana-58dc7468d7-tzsnh 1/1 Running 2 105m kube-state-metrics-769f4fd4d5-85f7p 3/3 Running 7 105m node-exporter-22l2n 2/2 Running 4 105m prometheus-adapter-5cd5798d96-ttfm2 1/1 Running 3 105m prometheus-k8s-0 3/3 Running 7 61m prometheus-k8s-1 3/3 Running 0 51m prometheus-operator-99dccdc56-klb8r 1/1 Running 4 105m ➜ kube-prometheus git:(master) ✗ 查看创建的服务,需要注意的是,我们需要修改prometheus-k8s和grafana这两个service的类型为NodePort;如下操作: ➜ kube-prometheus git:(master) ✗ k edit svc grafana -n monitoring ➜ kube-prometheus git:(master) ✗ k edit svc prometheus-k8s -n monitoring 查看修改完成的service; ➜ kube-prometheus git:(master) ✗ k get svc -n monitoring NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE alertmanager-main ClusterIP 10. [Read More]

prometheus学习系列(二)

minikube for Mac install

Prerequisites:

* macOS 10.12 (Sierra)
* A hypervisor such as Hyperkit, Parallels, VirtualBox, or VMware Fusion

Installation:

brew install minikube

Upgrading minikube:

brew update brew upgrade minikube

Hypervisor Setup for Hypervisor

**Usage**
Start a cluster using the hyperkit driver:
minikube start —vm-driver**=**hyperkit
To make hyperkit the default driver:
minikube config set vm-driver hyperkit

Increasing memory allocation:

minikube config set memory 4096

常用命令:

Start a cluster by running: minikube start Access the Kubernetes Dashboard running within the minikube cluster: minikube dashboard minikube service list Stop your local cluster: minikube stop Delete your local cluster: minikube delete Delete all local clusters and profiles minikube delete —all

prometheus学习系列(五)

prometheus Operator自定义监控nginx

目标 在生产环境中,我们需要除了监控kubernetes中的一些资源对象、节点以及组件,有时候还需要根据实际的业务添加自定义监控.添加自定义步骤如下: 1. 先创建一个ServiceMonitor对象,用于为Prometheus添加监控项 2. 将ServiceMonitor对象关联metrics数据接口的一个Service对象; 3. Service对象可以正确获取metrics数据 查看nginx完整的带metrics的文件 ➜ manifests git:(master) ✗ cat nginx.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx labels: app: nginx spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: billy98/nginx-prometheus-metrics:latest ports: - name: http-metrics containerPort: 9527 - name: web containerPort: 80 - name: test containerPort: 1314 imagePullPolicy: IfNotPresent --- apiVersion: v1 kind: Service metadata: labels: app: nginx name: nginx namespace: default spec: ports: - name: http-metrics port: 9527 protocol: TCP targetPort: 9527 - name: web port: 80 protocol: TCP targetPort: 80 - name: test port: 1314 protocol: TCP targetPort: 1314 selector: app: nginx type: NodePort ➜ manifests git:(master) ✗ 配置prometheus监控 ➜ manifests git:(master) ✗ cat prometheus-serviceMonitornginx. [Read More]

prometheus学习系列(六)

prometheus mail + wechat报警

首先把alertmanager-main这个service改为NodePort的server. ➜ manifests git:(master) ✗ k get svc -n monitoring NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE alertmanager-main NodePort 10.96.120.87 <none> 9093:31175/TCP 29h alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 29h grafana NodePort 10.96.163.124 <none> 3000:31263/TCP 29h kube-state-metrics ClusterIP None <none> 8443/TCP,9443/TCP 29h node-exporter ClusterIP None <none> 9100/TCP 29h prometheus-adapter ClusterIP 10.96.121.50 <none> 443/TCP 29h prometheus-k8s NodePort 10.96.129.132 <none> 9090:30525/TCP 29h prometheus-operated ClusterIP None <none> 9090/TCP 29h prometheus-operator ClusterIP None <none> 8080/TCP 29h ➜ manifests git:(master) ✗ 可以使用svc“alertmanager-main”的nodeport查看Alertmanager的Status状态,获取访问prometheus地址和alertmanager地址. [Read More]

prometheus学习系列(四)

prometheus service 自动发现配置

注意所在操作都在,manifests目录下面创建, ➜ manifests git:(master) ✗ cat prometheus-additional.yaml - job_name: ‘kubernetes-service-endpoints' kubernetes_sd_configs: - role: endpoints relabel_configs: - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] action: keep regex: true - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] action: replace target_label: __scheme__ regex: (https?) - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] action: replace target_label: __metrics_path__ regex: (.+) - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port] action: replace target_label: __address__ regex: ([^:]+)(?::\d+)?;(\d+) replacement: $1:$2 - action: labelmap regex: __meta_kubernetes_service_label_(.+) - source_labels: [__meta_kubernetes_namespace] action: replace target_label: kubernetes_namespace - source_labels: [__meta_kubernetes_service_name] action: replace target_label: kubernetes_name ➜ manifests git:(master) ✗ 使用这个文件创建一个secret对象并查看 ➜ manifests git:(master) ✗ kubectl create secret generic additional-configs --from-file=prometheus-additional. [Read More]

牛刀小试之docker容器系列(九)

使用dockerfile创建基于centos的ssh容器

使用dockerfile创建基于centos的ssh容器:

需求:
   打包的镜像需要支持SSH key和密码登录
1.首先创建目录/home/sshd_centos
[root@test-devops sshd_centos]# pwd
/home/sshd_centos
[root@test-devops sshd_centos]#

2.查看autorized.keys,需要注意的是,需要哪个机器使用key登录就把哪个客户的pub文件进去
[root@test-devops sshd_centos]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0OaHTmgsdKIrPCgULUk1XyRGhicQbPPJgQN85QTZNfA2iuK7PmkhoPnXLaRtMZl4se6xsBEuCn0Yougx4vFRzszDv/62XxjErqqC0vQBEWL4KaGCmDgEtwaE3oOBPA+kfIU0XITZuZx7KdPsaX2pngrv+EK3urs5kYUbwfQzE8G9JcqhWmGUxNWx+SvyspH5GaEMvxdpmZtitevEDfAGTnfp0DvR/C/5EcieS9MBHOAMEwm5mzVzvTV+HEN2GMmZAuooEUGlzTVyCRzJvddzzPDsVKZzLPhA8QYWYGg/bSDkrh5IFYBc5T/yDhD6xBbbFG+R4vT98iOqB7m9vXst9 zhangkeyuan@zhangkeyuandeMacBook-Air.local
[root@test-devops sshd_centos]#
3.给文件授权
[root@test-devops sshd_centos]# ll authorized_keys
-rw------- 1 root root 424 7月   2 17:43 authorized_keys
[root@test-devops sshd_centos]#
[Read More]
docker 

牛刀小试之docker容器系列(十)

使用dockerfile创建基于ubuntu的ssh容器

使用dockerfile创建基于ubuntu的ssh容器:

1.创建目录
[root@test-devops home]# mkdir sshd_ubuntu
[root@test-devops home]# cd sshd_ubuntu/
[root@test-devops sshd_ubuntu]# touch Dockerfile run.sh
[root@test-devops sshd_ubuntu]#

2.编写run.sh脚本和认证文件
[root@test-devops sshd_ubuntu]# cat run.sh
#!/bin/bash
/usr/sbin/sshd -D
[root@test-devops sshd_ubuntu]# chmod +x run.sh
[root@test-devops sshd_ubuntu]#

[root@test-devops sshd_ubuntu]# chmod 400 authorized_keys

3.编写dockerFile
[root@test-devops sshd_ubuntu]# cat Dockerfile
# 继承的镜像
FROM ubuntu:14.04

# 作者信息
MAINTAINER from steven (www.opsnotes.net)

# 安装SSH服务和VIM服务
RUN apt-get install -y openssh-server vim
RUN mkdir -p /var/run/sshd
RUN mkdir -p /root/.ssh
RUN echo 'root:123qwer' |chpasswd
RUN sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config
RUN sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config
RUN sed -i 's/^PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config

# 取消PAM限制
RUN sed -i '/pam_loginuid.so/c session    optional     pam_loginuid.so'  /etc/pam.d/sshd

# 复制文件,给脚本可执行权限
ADD authorized_keys /root/.ssh/authorized_keys
ADD run.sh /run.sh
RUN chmod +x /run.sh

# 设置开放端口
EXPOSE 22

# 设置自动开启命令
CMD ["/run.sh"]
[root@test-devops sshd_ubuntu]#
[Read More]
docker