New server environment to build summary, JDK, mysql, zookeeper, kafka

 

1.jdk

yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
JDK默认安装路径/usr/lib/jvm
vim /etc/profile
在/etc/profile文件添加如下命令
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64
PATH=$PATH:$JAVA_HOME/bin  
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar  
export JAVA_HOME  CLASSPATH  PATH
source  /etc/profile

 

2.mysql

1、yum仓库下载MySQL:sudo yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm


2、yum安装MySQL:sudo yum install mysql-community-server


3、启动MySQL服务:sudo service mysqld start


4、检查MySQL服务状态:sudo service mysqld status


5、查看初始密码(如无内容直接跳过):sudo grep 'temporary password' /var/log/mysqld.log
QCNU:>PnR4aO
6、本地MySQL客户端登录:mysql -uroot -p


7、输入密码为第5步查出的,如果没有,直接回车,然后输入命令  flush privileges


8、修改root登录密码:ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';(注意要切换到mysql数据库,使用use mysql)


9.设置外网访问
MySql中设置用户的访问
MySQL默认只允许从本机访问,要使得能够远程访问,分别在Terminal中执行以下命令:
mysql -u root -p
use mysql
update user set Host='%' where User='root'
这样就能从任意IP访问MySql了。


10.mysql8.0 修改密码限制
mysql> set global validate_password.policy=0;
mysql>  set global validate_password.length=1;


11. 查看加密方式
select host,user,plugin from user;
12 . 修改加密
update user set plugin='mysql_native_password' where user='root';
13.刷新授权
FLUSH PRI

 

3.zookeeper

#下载
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz
#解压
tar -zxf apache-zookeeper-3.5.5-bin.tar.gz -C /data/zookeeper/


cd /data/zookeeper/apache-zookeeper-3.5.5-bin/conf/
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
#替换zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper/apache-zookeeper-3.5.5-bin/tmp/zookeeper
clientPort=2181
http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance


#添加环境变量
vim ~/.bashrc
export ZOOKEEPER_HOME=/data/zookeeper/apache-zookeeper-3.5.5-bin
export PATH=$ZOOKEEPER_HOME/bin:$PATH


source ~/.bashrc
#启动
zkServer.sh start
#验证
zkServer.sh stat

In a time unit #ZK. All times are ZK to this time unit basis, multiplied by an integer configured. For example, the minimum time-out session is tickTime * 2 
tickTime = 2000 
#Follower during startup, will synchronize all the latest data from the Leader, and then be able to determine their initial state external services. Leader allows F to complete this work within initLimit time. Under normal circumstances, we do not care too much about setting this parameter. If the data amount of really big cluster ZK, F at boot time, the time from the synchronization data Leader becomes longer accordingly, so that in this case, it is necessary to appropriately adjust the parameters of the large 
initLimit = 10 
# in During operation, Leader responsible for communication with the ZK all the machines in the cluster, for example, through a number of heartbeat mechanism to detect the survival of the state of the machine. If L sent heartbeat packet after syncLimit, we have not received a response from F, where F is already then that this is not a line. Note: Do not take this parameter is set too high, otherwise it may mask some problems 
5 syncLimit = 
Catalog # memory snapshot file snapshot of. By default, the transaction log will be stored here. Also the configuration parameters dataLogDir, the transaction log write performance directly affects the performance of zk 
dataDir = / usr / local / ZooKeeper / ZooKeeper-3.4.13 / the Data 
# transaction log output directory. Try arranged separate disk or mount point to the output of the transaction log, which will greatly enhance the performance of ZK 
dataLogDir = / usr / local / ZooKeeper / ZooKeeper-3.4.13 / logs 
# client server connection port, i.e. the external service port, usually set to 2181 bar 
clientPort = 2181
# First port for data synchronization between the F and L and other communication, a second port for communication Leader Election voting process, server.x x here is a number that is consistent with the file id myid the 
server.1 = 127.0.0.1: 2888: 3888

 

4.kafka

#下载
wget https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.3.1/kafka_2.12-2.3.1.tgz -P /data/kafka
#解压
tar -zxvf kafka_2.12-2.3.1.tgz
cd /data/kafka
mkdir logs 
cd /data/kafka/kafka_2.12-2.3.1/config
vi server.properties
#修改这两项
log.dirs=/data/kafka/kafka_2.12-2.3.1/config
listeners=PLAINTEXT://192.168.2.104:9092

 

Published 15 original articles · won praise 21 · views 30000 +

Guess you like

Origin blog.csdn.net/q690080900/article/details/104944393