简单理解Mesos的master,slave和frameworks
Mesos是Apache开源的分布式集群管理器,和Google的集群管理系统Borg类似,负责在集群层面管理任务的编排工作。 Mesos将所有资源汇聚到一个单独的资源池中以避免静态划分,通过在多种框架之间动态共享资源来优化资源的使用率。 通过Mesos,我们可以把整个数据中心当作一台的机器来使用,Mesos可以看作是数据中心的内核。
Mesos是Apache开源的分布式集群管理器,和Google的集群管理系统Borg类似,负责在集群层面管理任务的编排工作。 Mesos将所有资源汇聚到一个单独的资源池中以避免静态划分,通过在多种框架之间动态共享资源来优化资源的使用率。 通过Mesos,我们可以把整个数据中心当作一台的机器来使用,Mesos可以看作是数据中心的内核。
firewalld firewalld是CentOS上的第四代防火墙(ipfwadm-ipchains-iptables-firewalld),CentOS 7将其作为系统默认的防火墙。 firewalld替换了原来的iptables并提供防火墙规则动态更新,即在更改规则时不需要重启服务,同时又增加了一个“区域”的概念。
生成自签名证书 因为没有公网ip和域名,所以这里修改/etc/pki/tls/openssl.cnf以生成带SAN 扩展的证书。 在openssl.cnf文件中修改以下内容: [ v3_ca ] #指定ip subjectAltName=IP:192.168.61.100 创建证书目录:
查看yum,rpm包安装的文件 可以使用repoquery,需要先安装yum-utils: yum install -y yum-utils repoquery --installed -l ntp /etc/dhcp/dhclient.d /etc/dhcp/dhclient.d/ntp.sh /etc/ntp.conf /etc/ntp/crypto /etc/ntp/crypto/pw /etc/sysconfig/ntpd /usr/bin/ntpstat ...... 也可以使用rpm命令:
进程的状态 进程是Linux系统结构的基础,进程简单的理解就是一段程序的执行过程。系统的每一个进程会有不同的状态。 Linux源码中对进程状态的定义fs/proc/array.c: static const char * const task_state_array[] = { "R (running)", /* 0 */ "S (sleeping)", /* 1 */ "D (disk sleep)", /* 2 */ "T (stopped)", /* 4 */ "t (tracing stop)", /* 8 */ "X (dead)", /* 16 */ "Z (zombie)", /* 32 */ }; 系统进程状态包括:
从Go 1.7 runtime包理解Golang GC Go也是垃圾回收的,实现方式和别的语言不太一样。 先从Go的标准库的runtime包说起,这个包有很多运行时相关的类型和函数。 调用runtimea.GC()可以触发GC,但我们一般不会这么做,先读一下这个函数的注释说明。 GC runs a garbage collection and blocks the caller until the garbage collection is complete. It may also block the entire program 大概的意思是,Go的GC触发时会阻塞整个程序的运行。这个在垃圾回收里面有一个比较有名的名词叫STW,Stop the World。就是说程序在GC时“整个世界会停止下来”。 Go垃圾回收的STW一直是Go语言被指责和诟病最多的地方,也是Go的每个版本都努力改进的地方。
MySQL日志类型 错误日志(Error log): mysqld启动,运行,停止相关的警告或错误信息 普通查询日志(General query log): 记录从连接客户端发出的SQL语句和MySQL命令 二进制日志(Binary log): 对数据库执行更新的语句,二进制日志也被用来在主从复制时使用 中继日志(Relay log): 主库推送的主库二进制日志中的事件到从库的中继日志,从库根据中继日志重做数据变更操作 慢查询日志(Slow query log): 执行时间超过long_query_time设定值的SQL语句,也可包含没有使用索引的SQL语句 DDL log (metadata log): Metadata operations performed by DDL statements 错误日志 MySQL的错误日志是默认开启,且必须开启。查看错误日志的位置:
关于leader的选举,Zookeeper提供了三种方式:LeaderElection, AuthFastLeaderElection, FastLeaderElection。 其中FastLeaderElection是Zookeeper默认使用的。 当ZK服务启动的时候首先要做的事情就是Leader的选举。在选举过程中,每个zk server会有以下四种选举状态:
map的内部结构 Go中的map使用哈希表实现的,在源码go runtime/hashmap.go中可以看到对应实现。 // A header for a Go map. type hmap struct { // Note: the format of the Hmap is encoded in ../../cmd/internal/gc/reflect.go and // ../reflect/type.go. Don't change this structure without also changing that code! count int // # live cells == size of map. Must be first (used by len() builtin) flags uint8 B uint8 // log_2 of # of buckets (can hold up to loadFactor * 2^B items) noverflow uint16 // approximate number of overflow buckets; see incrnoverflow for details hash0 uint32 // hash seed buckets unsafe.Pointer // array of 2^B Buckets. may be nil if count==0. oldbuckets unsafe.Pointer // previous bucket array of half the size, non-nil only when growing nevacuate uintptr // progress counter for evacuation (buckets less than this have been evacuated) // If both key and value do not contain pointers and are inline, then we mark bucket // type as containing no pointers. This avoids scanning such maps. // However, bmap.overflow is a pointer. In order to keep overflow buckets // alive, we store pointers to all overflow buckets in hmap.overflow. // Overflow is used only if key and value do not contain pointers. // overflow[0] contains overflow buckets for hmap.buckets. // overflow[1] contains overflow buckets for hmap.oldbuckets. // The first indirection allows us to reduce static size of hmap. // The second indirection allows to store a pointer to the slice in hiter. overflow *[2]*[]*bmap } // A bucket for a Go map. type bmap struct { // tophash generally contains the top byte of the hash value // for each key in this bucket. If tophash[0] < minTopHash, // tophash[0] is a bucket evacuation state instead. tophash [bucketCnt]uint8 // Followed by bucketCnt keys and then bucketCnt values. // NOTE: packing all the keys together and then all the values together makes the // code a bit more complicated than alternating key/value/key/value/... but it allows // us to eliminate padding which would be needed for, e.g., map[int64]int8. // Followed by an overflow pointer. } 先删掉代码原有注释,以便于查看:
slice的内部结构 一个slice本质上是一个数组的某个部分的引用。在go runtime/slice.go源码中定义了slice的结构: type slice struct { array unsafe.Pointer len int cap int } 可以看到在Go的内部,slice是一个包含3个字段的结构体: