猫言猫语

严以律己·宽以待人·自强不息·知行合一

Debian 9 安装 ZooKeeper

| Debian 9 安装 ZooKeeper已关闭评论

sudo apt install zookeeperd
sudo systemctl enable zookeeper
sudo systemctl restart zookeeper
root@stretch:/var/lib/zookeeper# /usr/share/zookeeper/bin/zkCli.sh
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 1]
[zk: localhost:2181(CONNECTED) 0] create /config.json {}
Created /config.json
[zk: localhost:2181(CONNECTED) 1]
[zk: localhost:2181(CONNECTED) 0] get /config.json
{}
cZxid = 0xb
ctime = Fri Apr 03 17:27:50 GMT+00:00 2020
mZxid = 0xb
mtime = Fri Apr 03 17:27:50 GMT+00:00 2020
pZxid = 0xb
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 2
numChildren = 0
[zk: localhost:2181(CONNECTED) 1]
[zk: localhost:2181(CONNECTED) 0] delete /config.json
[zk: localhost:2181(CONNECTED) 1]

解决 macOS zsh ssh 乱码

| 解决 macOS zsh ssh 乱码已关闭评论

最近使用 macOS zsh ssh 登录远程服务器时候,终端会出现如下提示内容:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

显示中文字符时会不规则的乱码,有些字符乱,有些字符不乱

解决办法是编辑 ~/.zshrc 文件,手动设置一下终端环境的语言编码:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Laravel 的 3 种运行环境

| Laravel 的 3 种运行环境已关闭评论

Laravel 可以在通过 APP_ENV 环境变量修改运行时环境,默认的 APP_ENV 是 local,其实他还可以设置其他值,分别是:

local 对应的 development 环境
testing 对应的 test 环境
production 对应的 production 环境

CentOS 7 安装 Tomcat 8

| CentOS 7 安装 Tomcat 8已关闭评论

网上有很多 CentOS 7 安装 Tomcat 8 教程,都是从 Apache 官网下载二进制包后解压启动,随意性太强。没有通过系统包管理来维护是不完美的。

yum install https://harbottle.gitlab.io/harbottle-main/7/x86_64/harbottle-main-release.rpm
yum install tomcat8
systemctl enable tomcat8
systemctl restart tomcat8

部署的时候把 war 文件放到 /var/lib/tomcat8/webapps 目录下即可。

树莓派禁用 swapfile

| 树莓派禁用 swapfile已关闭评论

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo systemctl disable dphys-swapfile

使用 rlwrap 解决 SQL*Plus 上下键问题

| 使用 rlwrap 解决 SQL*Plus 上下键问题已关闭评论

SQL*Plus 默认执行完之后,按上下左右键效果是上图的样子,非常不爽。

yum install -y epel-release
yum install -y rlwrap

之后使用 rlwrap sqlplus 来启动,效果就非常完美了

Ubuntu 18.04 安装 Docker 环境

| Ubuntu 18.04 安装 Docker 环境已关闭评论

snap install docker

配置文件位置是在

/var/snap/docker/current/config/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"log-level": "error",
"storage-driver": "aufs"
}

Ubuntu 安装 Valet

| Ubuntu 安装 Valet已关闭评论

sudo systemctl disable apache2
sudo apt-get install network-manager libnss3-tools jq xsel
composer global require cpriego/valet-linux
mkdir ~/Sites
~/.config/composer/vendor/bin/valet install
~/.config/composer/vendor/bin/valet park ~/Sites

macOS Mojave 手动安装 php-pecl-amqp

| macOS Mojave 手动安装 php-pecl-amqp已关闭评论

git clone https://github.com/pdezwart/php-amqp.git
cd php-amqp
phpize
./configure --with-librabbitmq-dir=/usr/local/Cellar/rabbitmq-c/0.9.0
make
make install
vi /usr/local/etc/php/7.3/conf.d/ext-amqp.ini
extension="amqp.so"