1月31日,Giblab在修复一个PostgreSQL数据同步问题(DB Replication lagged too far behind)时,误将生产环境的数据删除(本来是计划删除db1上的数据,结果发现在错误的db2上操作了)。进而寻求从备份数据恢复,结果发现没有实时备份:
... ➦layout: post title: Kubernetes HA date: 2017-03-15 18:12:47 tags: [kubernetes]
Kubernetes 从 1.5 开始,通过kops或者kube-up.sh部署的集群会自动部署一个高可用的系统,包括
从https://discovery.etcd.io/new?size=3获取 token 后,把https://kubernetes.io/docs/admin/high-availability/etcd.yaml放到每台机器的/etc/kubernetes/manifests/etcd.yaml,并替换掉${DISCOVERY_TOKEN}, ${NODE_NAME}和${NODE_IP},既可以由 kubelet 来启动一个 etcd 集群。
LinuxKit是Docker最新发布的一个用于为容器构建安全、便携、可移植操作系统的工具包。它根据用户编写的yaml(指定kernel和基于docker image的一些列服务)自动构建一个常见虚拟化平台或云平台的虚拟机镜像,并自动运行起来。主要特性包括
git clone https://github.com/linuxkit/linuxkit $GOPATH/src/github.com/linuxkit/linuxkit
make && make install
LinuxKit需要编写一个yaml文件,来配置所需要的服务。可选的配置包括
... ➦Kubernetes是一个开源项目,它把谷歌的集群管理工具引入到虚拟机和裸机场景中。它可以完美运行在现代的操作系统环境(比如CoreOS和Red Hat Atomic),并提供可以被你管控的轻量级的计算节点。Kubernetes使用Golang开发,具有轻量化、模块化、便携以及可扩展的特点。我们(Kubernetes开发团队)正在和一些不同的技术公司(包括维护着Mesos项目的MesoSphere)合作来把Kubernetes升级为一种与计算集群交互的标准方式。Kubernetes重新实现了Google在构建集群应用时积累的经验。这些概念包括如下内容:
... ➦awesome是Linux平台出色的窗口管理器,具有速度快、界面简捷等优点。其安装也比较简单:
sudo apt-get install -y awesome awesome-extra gnome-settings-daemon nautilus
sudo apt-get install -y --no-install-recommends gnome-session
mkdir -p ~/.config/awesome
常用快捷键整理:
切换程序
切换到下一个程序:Mod4 + j
切换到上一个程序:Mod4 + k
切换到主窗口中的第一个程序:Mod4 + Ctrl + Return
切换tag
切换到上一个选择的tag:Mod4 + Esc
切换到某个指定的tag:Mod4 + 1-9
切换到前一个tag:Mod4 + Left
切换到下一个tag:Mod4 + Right
程序窗口状态修改
最大化/非最大化:Mod4 + m
浮动/平铺:Mod4 + Ctrl + Space
最小化:Mod4 + n
从最小化中恢复:Mod4 + Ctrl + n
关闭程序:Mod4 + Shift + C
程序窗口的转移和显示
转移到某个tag:Mod4 + Shift + 1-9(或在某个tag名上按Mod4+鼠标左键)
增加到某些tag:Mod4 + Shift + Ctrl + 1-9
转移到下一个窗口中的位置:Mod4 + Shift + j
转移到上一个窗口中的位置:Mod4 + Shift + k
布局修改
当前程序窗口宽度增加5%:Mod4 + Shift + h
当前程序窗口宽度减少5%:Mod4 + Shift + l
切换到下一种布局方式:Mod4 + Space
切换到上一种布局方式:Mod4 + Ctrl + Space
窗口管理
重启awesome:Mod4 + Ctrl + r
退出awesome:Mod4 + Shift + q
运行某个命令:Mod4 + r
打开awesome菜单:Mod4 + w
多显示器下的操作
切换到下一个屏幕:Mod4 + Ctrl + j
切换到上一个屏幕:Mod4 + Ctrl + k
将程序发送到下一个屏幕:Mod4 + o
awk '{print NR, $0}' filename
awk '{$1=NR; print}' filename
awk '{print $1,$2}' fielname
awk '{print $NF}' filename
awk 'NF>0{print $0}' filename
awk 'NF>4{print $0}' filename
awk '/test.*/{print $0}' filename
awk '$1 ~ /^print.*/{print $0}' filename
awk 'BEGIN{sum=0}{sum+=$2}END{print sum}' filename
awk '{sum=0; for(i=1;i<=NF;i++)sum+=$i; print sum}' filename
awk '{n = split($0, array); print array[1], array[3]} ' filename
awk '{x[NR]=$0} END{for(i=NR;i>0;i--)print x[i]}' filename
awk '{amount[$1]=$2} END{for(name in amount) print name, amount[name]}' filename
A curated list of awesome big data frameworks, resources and other awesomeness. Inspired by awesome-php, awesome-python, awesome-ruby, hadoopecosystemtable & big-data.
Your contributions are always welcome!
Note: There is some term confusion in the industry, and two different things are called “Columnar Databases”. Some, listed here, are distributed, persistent databases built around the “key-map” data model: all data has a (possibly composite) key, with which a map of key-value pairs is associated. In some systems, multiple such value maps can be associated with a key, and these maps are referred to as “column families” (with value map keys being referred to as “columns”).
... ➦运行locale命令
LANG=
LANGUAGE=
LC_CTYPE=“POSIX”
LC_NUMERIC=“POSIX”
LC_TIME=“POSIX”
LC_COLLATE=“POSIX”
LC_MONETARY=“POSIX”
LC_MESSAGES=“POSIX”
LC_PAPER=“POSIX”
LC_NAME=“POSIX”
LC_ADDRESS=“POSIX”
LC_TELEPHONE=“POSIX”
LC_MEASUREMENT=“POSIX”
LC_IDENTIFICATION=“POSIX”
LC_ALL=
修改profile
vi /etc/profile
添加如下内容
export LC_ALL=en_US.UTF-8
source /etc/profile
得到错误 setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
运行 dpkg-reconfigure locales
得到错误
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = “en_US.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
his tutorial will show you how to bring up a single node Mesos cluster all provisioned out using Docker containers (a future post will show how to easily scale this out to multi nodes or see the update on the bottom). This means that you can startup an entire cluster with 7 commands! Nothing to install except for starting out with a working Docker server.
This will startup 4 containers:
As mentioned the only prerequisite is to have a working Docker server. This means you can bring up a local Vagrant box with Docker installed, use Boot2Docker, use CoreOS, instance on AWS, or however you like to get a Docker server.
... ➦Capabilities in Linux are flags that tell the kernel what the application is allowed to do, If you have no additional security mechanism in place, the Linux root user has all capabilities assigned to it. As capabilities are a way for running processes with some privileges, without having the need to grant them root privileges, it is important to understand that they exist.
Consider the ping utility. It is marked setuid root on some distributions, because the utility requires the (cap)ability to send raw packets. This capability is known as CAP_NET_RAW. However, thanks to capabilities, you can now mark the ping application with this capability and drop the setuid from the file. As a result, the application does not run with full root privileges anymore, but with the restricted privileges of the user plus one capability, namely the CAP_NET_RAW.
... ➦