docker安装 zookeeper, dubbo-admin

1 . 环境: cenos7(X86_64) + openssh 2 . 安装 配置镜像加速器, 尝试从Docker Hub下载, 速度太慢 /etc/docker/daemon.json { "max-concurrent-downloads":1, "registry-mirrors": [ "https://hub-mirror.c.163.com", "https://mirror.baidubce.com" ] } 抓取zookeeper镜像 docker pull zookeeper 抓取dubbo-admin镜像 docker pull apache/dubbo-admin 启动zookeeper容器 docker run --name zookeeper -p 2181:2181 -d zookeeper 启动duboo-admin容器 docker run -d \ -p 8081:8080 \ -e dubbo.registry.address=zookeeper://192.168.37.201:2181 \ -e dubbo.admin.root.password=root \ -e dubbo.admin.guest.password=guest \ apache/dubbo-admin 验证 浏览器输入 http://192.168.37.201:8081/ 参考及引用 http://blog.csdn.net/zxl8899/article/details/107413063 Photo by Steve Johnson from Pexels

2020-12-23 · 1 min · 68 words

Ext4 布局及inode,block信息统计

inode定义 node The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attributes may include metadata (times of last change,[2] access, modification), as well as owner and permission data.[3] from inode wiki inode数据结构用于描述文件系统中的文件、目录等, 每一个inode保存了文件系统系统对象memdata如修改时间,访问时间以及权限等。Dennis Ritchie对于inode中i可能代表index,而被访问的文件列表,被组织为存放存放在磁盘上的一维数组。 block ext4文件系统以block为单位分配存储空间。 环境准备 Linux Distributions: CentOS 7 通过fdisk划出一个10M分区, 格式化为ext4 ...

2020-09-16 · 10 min · 1951 words

Understanding Linux filesystems: ext4 and beyond

这篇文章Understanding Linux filesystems: ext4 and beyond 是出自opensource opensource.com 作者 Jim Salter 文章主要介绍ext简要历史,ext4一些特性及问题, 以及其他一些文件系统. ext发展过程 ext主要经历了MINIX文件系统, ext,ext2, ext3, ext几个阶段。 Minix文件系统 Andrew Tannenbaum 为了教学的目的而开发了MINIX,并于 1987 年发布。Minix有自己的文件系统, 不过比较简单最多只能处理14个字符的文件名,并且只能处理64MB的存储空间。 ext ext是由一名发过软件开发人员 Rémy Card 1992 年实现,同时他也设计了ext2, ext使用VFS抽象层,并且能够支持2G存储,以及255长度的文件名。关于时间戳,ext只有一个. ext2 Rémy Card 发现了ext的局限性,一年后也就是1993年他便设计出了ext2, ext2支持到GB级别文件大小和TB级别的文件系统大小, 但是磁盘碎片, 数据写入安全性上尚存在不足,比如: 如果在将数据写入磁盘时系统崩溃或断电,则容易发生灾难性损坏. ext3 1998年, Stephen Tweedie 改进ext2, 2001合并如2.4.25内核版本主线。ext3实现了日志来解决异常情况下数据写入不一致问题。 像之前的ext2一样,ext3使用16位内部寻址。 这意味着块大小为4K时,它可以处理的最大文件大小为2 TiB,最大文件系统大小为16 TiB。 ext4 Theodore Ts’o , 中文名曹子德 ext3主要开发人员。 2006年,发布ext4, 两年后加入 2.6.28 内核主线。 ext4比较ext3有很多新的特征:可以参见以下链接, https://ext4.wiki.kernel.org/index.php/New_ext4_features 作者文章发表的时候计划开发特征已经实现, 比如Metadata Checksums 3.1 Multiblock Allocation 3.2 Delayed Allocation 3.3 Exceed 32000 subdirectory limit 3.4 directory Inodes reservation 3.5 nsec timestamps 3.6 inode version on disk 3.7 uninitialized block groups 3.8 journal checksumming 3.9 persistent preallocation (fallocate) 3.10 Online Defragmentation 3.11 First Class Quota Support 3.12 Big Allocation Blocks 3.13 Metadata Checksums 3.14 Large file support 3.15 Large directory support ...

2020-09-16 · 1 min · 145 words

查看inode相关信息

inode定义 The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attributes may include metadata (times of last change,[2] access, modification), as well as owner and permission data.[3] from inode wiki inode数据结构用于描述文件系统中的文件、目录等, 每一个inode保存了文件系统系统对象memdata如修改时间,访问时间以及权限等。Dennis Ritchie对于inode中i可能代表index,而被访问的文件列表,被组织为存放存放在磁盘上的一维数组。 环境准备 Linux Distributions: CentOS 7 通过fdisk划出一个10M分区, 格式化为ext4 $ fdisk /dev/sdb ... # Start End Size Type Name 1 2048 8390655 4G Linux filesyste 2 8390656 8411135 10M Linux filesyste [root@centosgpt ~]# $ mkfs.ext4 /dev/sdb2 $ mount /dev/sdb2 /root/inode inode查看 ls ls -i 文件名or目录 ...

2020-09-15 · 2 min · 257 words

close-on-exec

简介 Donald E. Porter 教授的 CSE 506: Operating Systems 教材 VFS 部分中提到Linux文件操作使用的一个标识 CLOSE_ON_EXEC – a bit that prevents file inheritance if a new binary is exec’ed (set by open or fcntl) 这个标识位支持exec执行前关闭其从父进程继承来的文件描述符 使用 设置方法: 通过fcntl 设置FD_CLOEXEC int flags = fcntl(connfd, F_GETFD); flags |= FD_CLOEXEC; fcntl(connfd, F_SETFD, flags); 通过O_CLOEXEC open(path, O_CLOEXEC | flags) socket(DOMAIN, SOCK_CLOEXEC | type, PROTOCOL) accept4(int sockfd, struct sockaddr *addr, \ socklen_t *addrlen, SOCK_CLOEXEC | flags); fopen(path, "re") 可以在以下这种模式下使用, fork后还是dup了父进程的文件描述符,exec后将自动关闭. pid_t pid; pid = fork(); if (pid == 0) { exec(...) }; 验证 代码 server.c ...

2020-09-09 · 3 min · 526 words

Tiny Core Linux 安装配置

简介 Tiny Core Linux是一个mini Linux操作系统,基于 BusyBox和FLTK提供基本功能。 其发行版本在11M-16M 官网上也提供Plus版本也只有106M。它很精致。 安装 操作系统安装 镜像下载 下载页面 http://tinycorelinux.net/downloads.html 我下载了两个版本镜像: x86版本: TinyCore-11.1.iso x86_64位版本:TinyCorePure64-11.1.iso 环境准备 我们使用的vmware 首先新建一个linux虚拟机, 我选的版本是其他Linux5.x或更高版本内核64位, 并添加了两块SATA的硬盘(默认的SCSI硬盘识别似乎有些问题) 开始安装 安装过程主要下面三个步骤 : 光盘启动操作系统; 配置网络 下载安装脚本安装; 1 . 选择镜像: 光盘镜像选择 x86版本:TinyCore-11.1.iso (不影响安装) 2 . 启动系统: 启动后会出现四个选项, 选择第三项 Boot TinyCore Boot TinyCore (on slow devices, waitusb=5) Boot Core (command line only) Boot Core (command line only on slow devices, waitusb=5) 可以看到系统后进入命令行窗口,但是这种模式下进行操作重启将全部丢失。要保留我们相关配置,需要挂载硬盘。 3 . 配置网络: 配置网卡地址路由及域名服务器。 sudo ifconfig eth0 192.168.xxx.202 netmask 255.255.255.0 sudo route add default gw 192.168.xxx.1 dev eth0 sudo echo nameserver 192.168.xxx.1 >> /etc/resolv.conf 4 . 下载安装脚本: 会联机下载相关安装包 ...

2020-09-01 · 4 min · 738 words

dhclient error while loading shared libraries libdns-export.so.1102

环境: cenos7(X86_64) 问题: 网站显示无法链接数据库,重启后发现无法链接服务器,通过管理端登录服务器 /var/log/messages显示 dhclient: error while loading shared libraries: libdns-export.so.1102: cannot open shared object file: No such file or directory 修复: 需要root权限 # ldconfig # dhclient --help # systemctl restart NetworkManager.service # ip -a 其他 查找过程及问题: 由于前一阵刚好在服务器上增加了防火墙相关配置,所以当时开始一直判断是防火墙设置问题。关闭防火墙后仍无法访问。 排除防火墙问题后,查看了下网络配置发现eth0没有相关IP信息。 在到/var/log/messages中查看错误信息,最终通过error定位到dhclient错误. 当然还是决定改为静态方式配置IP, 我用的是eth0, 修改下面配置即可 /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="static" ONBOOT="yes" IPADDR=XXX.XXX.XXX.XXX NETMASK=255.255.255.0 GATEWAY=XXX.XXX.XXX.XXX DNS1=XXX.XXX.XXX.XXX 相关Bug Bug 1726534 与我遇到的问题一样, 大致的意思说就是说安装一些库的时候, 比如libapr虽然安装失败,导致 /etc/ld.so.cache 保存的是老版本libdns-export.so.100 不是新版本的libdns-export.so.1102 导致dhclient载入libdns-export.so.1102失败, 通过ldconfig重新更新一下 /etc/ld.so.cache即可。 serverfault.com-Cannot Access My Google VM after reboot

2020-08-25 · 1 min · 71 words

通过alternatives进行多版本间切换

上周在学习单点登录安装CAS Overlay Template要使用指定版本,当时机器上安装了多个版本的jdk使用alternatives命令进行了切换. 如果需要在多个版本应用间切换并进行管理可以使用这个命令。 alternative 前身是 Debian Linux的一个用 Perl实现的工具 update-alternatives 后续Red Hat重写了并重新命名使用在 Red Hatand CentOS版本中. alternative统一了有多个版本应用,但在UNIX中更认可通过环境变量来设置 通常定义在 /etc/profile 或 $HOME/.profile 下面用一个例子演示一下 如果有有一个应用 em ,他的新版本 nem, 由于习惯原因, 我们更习惯敲em, 可以通过下面步骤设置一下 创建 先创建两个脚本做为代表em nem应用 [root@centosgpt alternatives]# cat em #!/bin/bash echo " This is em " [root@centosgpt alternatives]# cat nem #!/bin/bash echo " This is nem " 生成一个alternative需要下面四个要素: alternatives --install <link> <name> <path> <priority> link : 统一应用名称,一个链接文件 name : alternative 的名称便于记忆 path : 实际版本的路径 priority :优先级 [root@centosgpt alternatives]# sudo alternatives --install /usr/bin/em uemacs /root/alternatives/em 1 [root@centosgpt alternatives]# sudo alternatives --install /usr/bin/em uemacs /root/alternatives/nem 99 [root@centosgpt alternatives]# alternatives --config uemacs There are 2 programs which provide 'uemacs'. Selection Command ----------------------------------------------- + 1 /root/alternatives/em * 2 /root/alternatives/nem 验证 [root@centosgpt ~]# em This is nem [root@centosgpt ~]# alternatives --config uemacs There are 2 programs which provide &#039;uemacs&#039;. Selection Command ----------------------------------------------- 1 /root/alternatives/em *+ 2 /root/alternatives/nem Enter to keep the current selection[+], or type selection number: 1 [root@centosgpt ~]# em This is em 移除 alternatives --remove <name> <path> ...

2020-06-28 · 2 min · 324 words

Linux Swap 启停及swappiness设置

生成swap分区 可以通过磁盘分区和文件两种方式进行操作 1. 通过磁盘分区 划出一块4G磁盘fdisk /dev/sdb sdb磁盘对应的文件 [root@centosgpt ~]# fdisk /dev/sdb Command (m for help): n Partition number (1-128, default 1): First sector (34-41943006, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-41943006, default 41943006): +4G Created partition 1 ... Command (m for help): p ... # Start End Size Type Name 1 2048 8390655 4G Linux filesyste .. Command (m for help): w The partition table has been altered! 创建分区mkswap /dev/sdb1 sdb1对应分区 [root@centosgpt ~]# mkswap /dev/sdb1 Setting up swapspace version 1, size = 1020 KiB no label, UUID=5dabc5b1-d763-4757-9e0c-383f0cacb0ea 2. 通过文件生成 生成文件dd if=/dev/zero of=/swap bs=1MB count=1024 ...

2020-06-21 · 2 min · 344 words

Timers and time management in the Linux kernel. Part 6

这篇文章 Timers and time management in the Linux kernel. Part 6. 是出自 linux-insides一书中 Timers and time management 章节 内核版本比对5.7-rc1 进行了相关调整, 增加相关备注 Linux内核中的定时器和时间管理.Part 6. x86_64 相关的时钟源 这是chapter的第六部分,它描述了Linux内核中与计时器和时间管理相关的内容。 在之前的part中,我们看到了clockevents框架,现在我们将继续深入探讨与时间管理相关的问题 Linux内核中的内容。 本部分将描述与时钟源相关的x86架构的实现(有关[clocksource]概念的更多信息,您可以在second part 中找到相关信息. 首先,我们必须知道在x86体系结构中可以使用哪些时钟源。 从 sysfs 或者从下面的文件 /sys/devices/system/clocksource/clocksource0/available_clocksource. /sys/devices/system/clocksource/clocksourceN来获取相关信息: available_clocksource - 提供系统可用是时钟源 current_clocksource - 提供系统当前使用时钟源 实际看一下: $ cat /sys/devices/system/clocksource/clocksource0/available_clocksource tsc hpet acpi_pm 我们可以看到有三个注册的时钟源在这个系统里: tsc - Time Stamp Counter; hpet - High Precision Event Timer; acpi_pm - ACPI Power Management Timer. 现在让我们看看第二个文件,它提供了最佳时钟源(在系统中具有最佳评级的时钟源) $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource tsc tsc是Time Stamp Counter的简写. second part有过描述, 他描述了Linux Kernel的clocksource框架, 系统最好的时钟源应当是最有最好或最高功率,频率的, 或者说是具有最高frequency. ...

2020-04-27 · 6 min · 1139 words