Linux基础(一)
2019-03-15 本文已影响0人
Grey____
注意:此处指的Ubuntu环境,其他Linux环境略有不同
安装Redis服务器端
- 安装
sudo apt-get install redis-server
- 检查Redis服务器系统进程
root@hadoop-master ~# ps -aux|grep redis
redis 22887 0.0 0.0 40136 3176 ? Ssl 10:58 0:00 /usr/bin/redis-server 127.0.0.1:6379
root 25339 0.0 0.0 14224 968 pts/0 S+ 11:01 0:00 grep --color=auto redis
- 通过启动命令检查Redis服务器状态
root@hadoop-master ~# netstat -nlt|grep 6379
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
- 查看redis状态
service redis status
- 允许远程访问
vi /etc/redis/redis.conf
# bind 127.0.0.1 #将改行注释掉
修改Mysql时区
1.进mysql查看
root@hadoop-master ~# mysql -uroot -proot
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2019-03-15 11:39:07 |
+---------------------+
1 row in set (0.00 sec)
mysql> show variables like "%time_zone%";
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | SYSTEM |
+------------------+-------
- 名为 CST 的时区是一个很混乱的时区,在与 MySQL 协商会话时区时,Java 会误以为是 CST -0500 ,而非 CST +0800
- 修改配置文件【永久生效】
vi /etc/mysql/mysql.conf.d/mysqld.cnf
文件末尾追加:default-time_zone = '+8:00'
修改mysql参数【临时生效】
mysql> set global time_zone = '+08:00';
Query OK, 0 rows affected (0.00 sec)
mysql> set time_zone = '+08:00';
Query OK, 0 rows affected (0.00 sec)
- 查看
mysql> show variables like "%time_zone%";
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | +08:00 |
+------------------+--------+
2 rows in set (0.00 sec)
修改当前用户(es)的软硬限制
vi /etc/security/limits.conf
- 在文件的最后追加如下配置
es soft nofile 65535
es hard nofile 65537
上面两行语句表示,es用户的软限制为65535,硬限制为65537,
即表示es用户能打开的最大文件数量为65537,不管它开启多少个shell。
硬限制是严格的设定,必定不能超过这个设定的数值。
软限制是警告的设定,可以超过这个设定的值,但是若超过,则有警告信息。
在设定上,通常soft会比hard小,举例来说,sofr可以设定为80,而hard设定为100,那么你可以使用到90(因为没有超过100),但介于80~100之间时,系统会有警告信息。
- 修改了limits.conf,不需要重启,重新登录即生效
- 查询是否生效
命令:```ulimit -n``` 等价于 ```ulimit -S -n```
结果:65535
查看当前用户的硬限制
命令:```ulimit -H -n```
结果:65537
修改用户拥有的内存权限
问题:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
方法一:立即生效,但重启后失效
- 切到root,执行
sysctl -w vm.max_map_count=262144
- 查看结果:
sysctl -a|grep vm.max_map_count
方法二:可永久修改
-
vi /etc/sysctl.conf
文件最后添加一行
vm.max_map_count=262144
- 重启