首页 > 系统相关 >有关本地集群的linux操作tips

有关本地集群的linux操作tips

时间:2023-05-07 14:22:34浏览次数:39  
标签:username01 pdir ntp 集群 ssh file linux tips root

免密登录认证

-1. 使用rsa加密技术,生成公钥和私钥。一路回车即可
[root@username01 ~]# cd ~
[root@username01 ~]# ssh-keygen -t rsa	

-2. 进入~/.ssh目录下,使用ssh-copy-id命令
[root@username01 ~]# cd ~/.ssh			
[root@username01 .ssh]# ssh-copy-id  root@username01

-3. 进行验证	
[hadoop@username01 .ssh]# ssh username01
#下面的第一次执行时输入yes后,不提示输入密码就对了
[hadoop@username01 .ssh]# ssh localhost
[hadoop@username01 .ssh]# ssh 0.0.0.0

注意:三台机器提前安装好的情况下,需要同步公钥文件。如果使用克隆技术。那么使用同一套密钥对就方便多了。

linux ubuntu 自动登录root账户

https://blog.csdn.net/m0_46128839/article/details/116133371

跟着走一遍

linux 服务管理

查看所有开机启动项

systemctl list-unit-files | grep enabled

开启或关闭开机自启动服务

systemctl disable/enable [service_name]

服务管理

https://blog.csdn.net/liuchonghua/article/details/81743606

linux 集群执行脚本

集群同步

#!/bin/bash

for file in $@
do
	for host in CentOS002 CentOS003
	do
		if [ -e $file ]
		then
			pdir=$(cd -P $(dirname $file); pwd)
		
			fname=$(basename $file)
			ssh $host "mkdir -p $pdir"
			rsync -av $pdir/$fname $host:$pdir
			echo send $pdir/$file to $host:$pdir ...

		else
			echo $file does not exists!
		fi
	done
done  
echo done.

集群执行

#!/bin/bash

for file in $@
do
	for host in CentOS002 CentOS003
	do
		if [ -e $file ]
		then
			pdir=$(cd -P $(dirname $file); pwd)
		
			fname=$(basename $file)
			
			rsync -av $pdir/$fname $host:/tmp
			ssh $host "sh /tmp/$fname"
			echo send $file to $host:/tmp

		else
			echo $file does not exists!
		fi
	done
done  
echo done.

linux关闭防火墙

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

linux 集群时间同步

时间同步

# 1 选择集群中的某一台机器作为时间服务器,例如username01
# 2 保证这台服务器安装了ntp.x86_64。
# 3 保证ntpd 服务运行......
[root@username01 ~]# sudo service ntpd start
# 	开机自启动:
[root@username01 ~]# chkconfig ntpd on
	
# 4 配置相应文件:
[root@username01 ~]# vi /etc/ntp.conf
	
	# Hosts on local network are less restricted.
	# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
  # 添加集群中的网络段位
	restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap

	# Use public servers from the pool.ntp.org project.
	# Please consider joining the pool (http://www.pool.ntp.org/join.html).
	# server 0.centos.pool.ntp.org iburst    注释掉
	# server 1.centos.pool.ntp.org iburst	   注释掉
	# server 2.centos.pool.ntp.org iburst    注释掉
	# server 3.centos.pool.ntp.org iburst    注释掉
	server 127.127.1.0     -master作为服务器
# 5 其他机器要保证安装ntpdate.x86_64

# 6 其他机器要使用root定义定时器
*/1 * * * * /usr/sbin/ntpdate -u username01 

标签:username01,pdir,ntp,集群,ssh,file,linux,tips,root
From: https://www.cnblogs.com/aminor/p/17379271.html

相关文章

  • linux之安装图形界面
    前言:大家在学习linux过程中,有图形界面会方便不少,故此记录linux下安装图形界面过程。注意:安装图形界面之前,需要给虚拟机设置网络IP,并且可以ping通百度 第一步:先安装一下XWINDOWS,这个控制功能,命令如下(这个安装过程耗时较长)yumgroupinstall"XWindowSystem" 第二步:输......
  • 用CPU来加速你的Linux命令
    我们都知道grep,bzip2,wc,awk,sed等等,都是单线程的,只能使用一个CPU内核。那么如何才能使用这些内核?要想让Linux命令使用所有的CPU内核,我们需要用到GNUParallel命令,它让我们所有的CPU内核在单机内做神奇的map-reduce操作,当然,这还要借助很少用到的–pipes参数(也叫做–spreads......
  • 在 AlmaLinux 9安装Docker Compose
    首先先安装Docker如何在AlmaLinux8上安装和使用Docker检查Docker版本docker--version安装DockerComposesudocurl-L"https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-$(uname-s)-$(uname-m)"-o/usr/local/bin/docker-compose设置......
  • Linux deplay 安装 Ubuntu 及 MySQL
    设备支持:已root的mi-4(架构:armv71)软件支持:LinuxDeplay在Linuxdeplay上安装好你希望安装的Linux版本,我这里安装的是Ubuntu18.04(bionic),注意要根据手机的处理器型号选择适配的处理器版本,由于mi-4的处理器是armv71,发行版本选择armhfARMCortex-A系列(A53、A57、......
  • Book-Linux 系统编程-41章 共享库基础
    Book-Linux系统编程-41章共享库基础共享库是一种将库函数打包成一个单元使之能够在运行时被多个进程共享的技术。这种技术能够节省磁盘空间和RAM。41.1目标库构建程序的一种方式是简单地将每一个源文件编译成目标文件,然后将这些目标文件链接在一起组成一个可执行程序,如下所......
  • linux 中使用alias命令创建环境变量
     001、创建前[root@PC1hiblup]#lshibluphiblup_1.3.1_linux_x86_64_20230220.tar.gzhiblup.log[root@PC1hiblup]#hiblup##测试hiblup命令bash:hiblup:commandnotfound... 002、使用alias命令创建环境变量[root@PC1hiblup]#lshibluphiblup_1......
  • Linux驱动开发笔记(一):helloworld驱动源码编写、makefile编写以及驱动编译基本流程
    前言  基于linux的驱动开发学习笔记,本篇是描述了一个字符驱动的基础开发流程,以便做嵌入式开发多年的应用或者系统学习驱动开发。 笔者自身情况  笔者拥有硬件基础,单片机软硬基础,linux系统基础等各种,就是没有linux驱动框架基础,未做过linux系统移植和驱动移植开发了......
  • openGauss 5.0 主从集群 日常运维
    在之前的博客我们看了openGauss主从集群的搭建,如下:openGauss5.0一主两从复制环境搭建手册https://www.cndba.cn/dave/article/116528本篇我们看下主从集群的维护。 1查看集群状态查看集群所有节点:[[email protected]~]$gs_om-tstatus--detail[CMServerSta......
  • 部署repmgr PG14集群<无autofailover>
    系统环境OS:CentOS7192.168.56.11node1192.168.56.12node2部署操作流程1.系统环境初始化echoredhat|passwdroot--stdinecho-e"192.168.56.11node1">>/etc/hostsecho-e"192.168.56.12node2">>/etc/hostsse......
  • 快速上手Linux核心命令(十一):Linux用户相关命令
    目录前言useradd创建用户usermod修改用户信息userdel删除用户groupadd创建新的用户组groupdel删除用户组passwd修改用户密码chage修改用户密码有效期批量更新用户密码su切换用户visudo编辑sudoers文件sudo以另一个用户身份执行命令id显示用户与用户组信息w显示已登录......