丙午🐎年

acc8226 的博客

设置日期和时间

liunx 系统中两种时间: 一种是 UTC, 另一种是本地时间,两者区别为时区不同。

查看当前时间 date

1
2
date
2020年 03月 29日 星期日 18:52:32 CST

查看当前时区 date -R

1
2
date -R
Sun, 29 Mar 2020 18:53:41 +0800

查看 UTC 时间 data -u

1
2
date -u
2020年 03月 29日 星期日 10:53:31 UTC

修改日期 data -s

1
2
3
# 使用 data -s
date -s "2018-05-17"
date -s "2020-3-27 11:59:11"
阅读全文 »

Apache ZooKeeper 是一个开发和维护开源服务器的项目,它支持高度可靠的分布式协调。

下载地址

zookeeper-3.4.14 下载地址
https://mirrors.bfsu.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

遇到过的问题

Zookeeper 3.5 启动时 8080 端口被占用

通过查阅 Zookeeper3.5 的官方文档,发现这是 Zookeeper3.5 的新特性:

1
New in 3.5.0: The AdminServer is an embedded Jetty server that provides an HTTP interface to the four letter word commands. By default, the server is started on port 8080, and commands are issued by going to the URL "/commands/[command name]", e.g., http://localhost:8080/commands/stat. The command response is returned as JSON. Unlike the original protocol, commands are not restricted to four-letter names, and commands can have multiple names; for instance, "stmk" can also be referred to as "set_trace_mask". To view a list of all available commands, point a browser to the URL /commands (e.g., http://localhost:8080/commands). See the AdminServer configuration options for how to change the port and URLs.

这是 Zookeeper AdminServer,默认使用 8080 端口,它的配置属性如下:

我们可以修改在 zoo.cfg 中修改 AdminServer 的端口:

1
admin.serverPort=8888

保存后,再次启动,Zookeeper 启动成功。

这是 zookeeper 自己搞了一个简易应用服务器,可以查看一些信息

listint and issuing commands

阅读全文 »

whoami
要查看当前登录用户的用户名

who am i
表示打开当前伪终端的用户的用户名

创建用户
useradd 只创建用户,创建完了用 passwd xxx 去设置新用户的密码。

修改密码
passwd 命令是 password 这个英语单词的缩写,表示“密码”

删除用户
deluser newname

阅读全文 »

Shell 变量

使用 declare 命令创建一个变量名为 tmp 的变量:declare tmp

其实也可以不用 declare 预声明一个变量,直接即用即创建,这里只是告诉你 declare 的作用,这在创建其它指定类型的变量(如数组)时会用到。

使用 = 号赋值运算符,将变量 tmp 赋值为 shiyanlou。注意,与其他语言不同的是, Shell 中的赋值操作,= 两边不可以输入空格,否则会报错。

阅读全文 »

通常 Linux 上的软件安装主要有四种方式

  • 在线安装
  • 从磁盘安装软件包
  • 从二进制软件包安装
  • 从源代码编译安装
阅读全文 »
0%