• [交流分享] linux pwd cd 查看与切换工作目录
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux ls cd 查看与切换工作目录 #### pwd 查看当前的工作目录 ``` bash $ pwd /home/vhjwYUS ``` #### cd 切换工作目录 ``` bash $ cd /etc/ssh/ $ pwd /etc/ssh $ cd ~ $ pwd /home/vhjwYUS ``` #### ls 查看目录的属性 ``` bash $ ls -dl /etc/ssh drwxr-xr-x. 3 root root 4096 Mar 16 12:41 /etc/ssh ```   ### 帮助文档(部分) ``` bash $ pwd --help pwd: pwd [-LP] Print the name of the current working directory. Options: -L print the value of $PWD if it names the current working directory -P print the physical directory, without any symbolic links By default, `pwd' behaves as if `-L' were specified. Exit Status: Returns 0 unless an invalid option is given or the current directory cannot be read. ``` ``` bash $ help cd cd: cd [-L|[-P [-e]] [-@]] [dir] Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable. The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used. If the directory is not found, and the shell option `cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR. Options: -L force symbolic links to be followed: resolve symbolic links in DIR after processing instances of `..' ...... ``` ``` bash $ ls --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE with -l, scale sizes by SIZE when printing them; e.g., '--block-size=M'; see SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux history 查看历史命令
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux history 查看历史命令 ``` bash $ history 1 cd .. 2 cd . 3 cd . 4 ps 5 ps aux 6 ps aux 7 ps aux 8 ps auxf ...... ``` #### 历史命令存储在.bash_history ``` bash $ cat ~/.bash_history #1616666205 cd .. #1616666207 cd . #1616666210 cd . #1616666213 ps #1616666216 ps aux #1616666388 ps aux #1616666409 ...... ```   ### 帮助文档(部分) ``` bash $ history --help history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...] Display or manipulate the history list. Display the history list with line numbers, prefixing each modified entry with a `*'. An argument of N lists only the last N entries. Options: -c clear the history list by deleting all of the entries -d offset delete the history entry at position OFFSET. Negative offsets count back from the end of the history list -a append history lines from this session to the history file -n read all history lines not already read from the history file and append them to the history list -r read the history file and append the contents to the history list -w write the current history to the history file -p perform history expansion on each ARG and display the result without storing it in the history list -s append the ARGs to the history list as a single entry If FILENAME is given, it is used as the history file. Otherwise, if HISTFILE has a value, that is used, else ~/.bash_history. If the HISTTIMEFORMAT variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each displayed history entry. No time stamps are printed otherwise. Exit Status: Returns success unless an invalid option is given or an error occurs. ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux uname 查看系统内核和系统版本信息
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux uname 查看系统内核和系统版本信息 ``` bash $ uname --all Linux ecs-openeuler 4.19.90-2003.4.0.0036.oe1.x86_64 #1 SMP Mon Mar 23 19:10:41 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux $ uname --kernel-name Linux $ uname --nodename ecs-openeuler $ uname --kernel-release 4.19.90-2003.4.0.0036.oe1.x86_64 $ uname --machine x86_64 $ uname --processor x86_64 $ uname --hardware-platform x86_64 $ uname --operating-system GNU/Linux $ uname --version uname (GNU coreutils) 8.31 Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later /gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David MacKenzie. ```   ### 帮助文档(部分) ``` bash $ uname --help Usage: uname [OPTION]... Print certain system information. With no OPTION, same as -s. -a, --all print all information, in the following order, except omit -p and -i if unknown: -s, --kernel-name print the kernel name -n, --nodename print the network node hostname -r, --kernel-release print the kernel release -v, --kernel-version print the kernel version -m, --machine print the machine hardware name -p, --processor print the processor type (non-portable) -i, --hardware-platform print the hardware platform (non-portable) -o, --operating-system print the operating system --help display this help and exit --version output version information and exit GNU coreutils online help: /www.gnu.org/software/coreutils/> Full documentation /www.gnu.org/software/coreutils/uname> or available locally via: info '(coreutils) uname invocation' ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux pidof 查看指定服务进程的pid值
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux pidof 查看指定服务进程的pid值 ``` bash $ pidof sshd 507876 507874 507873 507854 505477 505452 3524 ``` ``` bash $ ps aux | grep sshd root 3524 0.0 0.4 13448 7268 ? Ss Mar16 0:00 /usr/sbin/sshd -D root 505452 0.0 0.5 15100 8584 ? Ss 17:16 0:00 sshd: root [priv] root 505477 0.0 0.3 15100 5156 ? S 17:16 0:00 sshd: root root 507854 0.0 0.5 15100 8404 ? Ss 17:57 0:00 sshd: vhjwYUS [priv] vhjwYUS 507873 0.0 0.3 15100 4992 ? S 17:58 0:00 sshd: vhjwYUS root 507874 0.0 0.5 15096 9008 ? Ss 17:58 0:00 sshd: vhjwYUS [priv] vhjwYUS 507876 0.0 0.3 15096 4972 ? S 17:58 0:00 sshd: vhjwYUS@pts/0 vhjwYUS 509061 0.0 0.0 213308 900 pts/0 S+ 18:18 0:00 grep --color=auto sshd ```   ### 帮助文档(部分) ``` bash $ pidof --help Usage: pidof [options] [program [...]] Options: -s, --single-shot return one PID only -c, --check-root omit processes with different root -x also find shells running the named scripts -o, --omit-pid omit processes with PID -S, --separator SEP use SEP as separator put between PIDs -h, --help display this help and exit -V, --version output version information and exit For more details see pidof(1). ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux ps 查看系统中的进程状态
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux ps 查看系统中的进程状态 #### BSD的格式 ps aux ``` bash $ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.7 106296 11532 ? Ss 2313 0:06 /usr/lib/systemd/systemd --switched-root --syst root 2 0.0 0.0 0 0 ? S 2313 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? I 2313 0:00 [rcu_gp] root 4 0.0 0.0 0 0 ? I 2313 0:00 [rcu_par_gp] root 6 0.0 0.0 0 0 ? I 2313 0:00 [kworker/0:0H-kblockd] root 7 0.0 0.0 0 0 ? I 2313 0:02 [kworker/u4:0-events_unbound] ``` #### BSD的格式+树形结构展示 ps auxf ``` bash $ ps auxf ...... USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2 0.0 0.0 0 0 ? S 2313 0:00 [kthreadd] root 47 0.0 0.0 0 0 ? S Mar16 0:00 \_ [kswapd0] root 98 0.0 0.0 0 0 ? I Mar16 0:00 \_ [kthrotld] root 99 0.0 0.0 0 0 ? I Mar16 0:00 \_ [acpi_thermal_pm] ...... ```   #### 标准格式 ps -ef ``` bash $ ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 2313 ? 00:00:06 /usr/lib/systemd/systemd --switched-root --system --deserializ root 2 0 0 2313 ? 00:00:00 [kthreadd] root 3 2 0 2313 ? 00:00:00 [rcu_gp] root 4 2 0 2313 ? 00:00:00 [rcu_par_gp] ```   ### 帮助文档(部分) ``` bash # ps --help Usage: ps [options] Try 'ps --help ' or 'ps --help ' for additional help text. For more details see ps(1). ``` ``` bash # ps --help a Usage: ps [options] Basic options: -A, -e all processes -a all with tty, except session leaders a all with tty, including other users -d all except session leaders -N, --deselect negate selection r only running processes T all processes on this terminal x processes without controlling ttys Selection by list: -C command name -G, --Group real group id or name -g, --group session or effective group name -p, p, --pid process id ...... ```   ### 参考资料 * https://blog.csdn.net/a12345555555/article/details/72770789 * https://blog.csdn.net/ruibin_cao/article/details/84660224   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux date 按照指定格式来查看时间
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux date 按照指定格式来查看时间 ``` bash date "+%Y%m%d%H%M%S" 20210325173020 ``` ``` bash date "+%Y%m%d-%H%M%S" 20210325-173110 ```   ### 帮助文档(部分) ``` bash # date --help Usage: date [OPTION]... [+FORMAT] or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] Display the current time in the given FORMAT, or set the system date. Mandatory arguments to long options are mandatory for short options too. -d, --date=STRING display time described by STRING, not 'now' --debug annotate the parsed date, and warn about questionable usage to stderr -f, --file=DATEFILE like --date; once for each line of DATEFILE -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format. FMT='date' for date only (the default), 'hours', 'minutes', 'seconds', or 'ns' for date and time to the indicated precision. Example: 2006-08-14T02:34:56-06:00 -R, --rfc-email output date and time in RFC 5322 format. Example: Mon, 14 Aug 2006 02:34:56 -0600 --rfc-3339=FMT output date/time in RFC 3339 format. FMT='date', 'seconds', or 'ns' for date and time to the indicated precision. Example: 2006-08-14 02:34:56-06:00 -r, --reference=FILE display the last modification time of FILE -s, --set=STRING set time described by STRING -u, --utc, --universal print or set Coordinated Universal Time (UTC) --help display this help and exit --version output version information and exit FORMAT controls the output. Interpreted sequences are: %% a literal % %a locale's abbreviated weekday name (e.g., Sun) %A locale's full weekday name (e.g., Sunday) %b locale's abbreviated month name (e.g., Jan) %B locale's full month name (e.g., January) %c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) %C century; like %Y, except omit last two digits (e.g., 20) %d day of month (e.g., 01) ...... ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux systemctl 查看服务状态和开机启动
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux systemctl 查看服务状态和开机启动 #### 查看服务状态 ``` bash # systemctl status rsyslog.service ● rsyslog.service - System Logging Service Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-03-16 12:41:33 CST; 1 weeks 1 days ago Docs: man:rsyslogd(8) https://www.rsyslog.com/doc/ Main PID: 720 (rsyslogd) Tasks: 3 Memory: 8.3M CGroup: /system.slice/rsyslog.service └─720 /usr/sbin/rsyslogd -n -iNONE Mar 16 12:41:33 localhost.localdomain systemd[1]: Starting System Logging Service... Mar 16 12:41:33 localhost.localdomain rsyslogd[720]: [origin software="rsyslogd" swVersion="8.1907.0" x-pid="720" x-info="https://> Mar 16 12:41:33 localhost.localdomain rsyslogd[720]: imjournal: No statefile exists, /run/log/imjournal.state will be created (ign> Mar 16 12:41:33 localhost.localdomain systemd[1]: Started System Logging Service. Mar 23 18:12:05 ecs-openeuler rsyslogd[720]: imjournal: journal reloaded... [v8.1907.0 try https://www.rsyslog.com/e/0 ] ``` #### 查看是否为开机启动 ``` bash # systemctl is-enabled rsyslog.service enabled ```   ### 帮助文档(部分) ``` bash # systemctl --help systemctl [OPTIONS...] {COMMAND} ... Query or send control commands to the systemd manager. -h --help Show this help --version Show package version --system Connect to system manager --user Connect to user service manager -H --host=[USER@]HOST Operate on remote host -M --machine=CONTAINER Operate on local container -t --type=TYPE List units of a particular type --state=STATE List units with particular LOAD or SUB or ACTIVE state --failed Shorcut for --state=failed -p --property=NAME Show only properties by this name -a --all Show all properties/all units currently in memory, including dead/empty ones. To list all units installed on the system, use the 'list-unit-files' command instead. ...... ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux 查看系统的默认启动目标target
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux 查看系统的默认启动目标 ``` bash # systemctl get-default multi-user.target ``` ``` bash # ls /etc/systemd/system -l | grep default lrwxrwxrwx. 1 root root 37 May 18 2020 default.target -> /lib/systemd/system/multi-user.target ``` ### 查看/lib/systemd/system中的target文件 ``` bash # ls /lib/systemd/system -l | grep .target -rw-r--r--. 1 root root 919 Sep 3 2019 basic.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 basic.target.wants -rw-r--r--. 1 root root 419 Sep 3 2019 bluetooth.target -rw-r--r--. 1 root root 455 Sep 3 2019 boot-complete.target -rw-rw-r-- 1 root root 536 Aug 18 2018 cloud-config.target -rw-rw-r-- 1 root root 255 Aug 18 2018 cloud-init.target -rw-r--r--. 1 root root 465 Sep 3 2019 cryptsetup-pre.target -rw-r--r--. 1 root root 412 Sep 3 2019 cryptsetup.target lrwxrwxrwx. 1 root root 13 Mar 24 2020 ctrl-alt-del.target -> reboot.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 dbus.target.wants lrwxrwxrwx. 1 root root 16 Mar 24 2020 default.target -> graphical.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 default.target.wants -rw-r--r--. 1 root root 471 Sep 3 2019 emergency.target -rw-r--r--. 1 root root 541 Sep 3 2019 exit.target -rw-r--r--. 1 root root 480 Sep 3 2019 final.target -rw-r--r--. 1 root root 506 Sep 3 2019 getty-pre.target -rw-r--r--. 1 root root 500 Sep 3 2019 getty.target -rw-r--r--. 1 root root 598 Sep 3 2019 graphical.target drwxr-xr-x. 2 root root 4096 May 18 2020 graphical.target.wants -rw-r--r--. 1 root root 527 Sep 3 2019 halt.target -rw-r--r--. 1 root root 509 Sep 3 2019 hibernate.target -rw-r--r--. 1 root root 530 Sep 3 2019 hybrid-sleep.target -rw-r--r--. 1 root root 593 Sep 3 2019 initrd-fs.target -rw-r--r--. 1 root root 561 Sep 3 2019 initrd-root-device.target -rw-r--r--. 1 root root 566 Sep 3 2019 initrd-root-fs.target -rw-r--r--. 1 root root 777 Sep 3 2019 initrd-switch-root.target -rw-r--r--. 1 root root 763 Sep 3 2019 initrd.target drwxr-xr-x. 2 root root 4096 May 18 2020 initrd.target.wants -rw-r--r--. 1 root root 173 Mar 24 2020 iprutils.target -rw-r--r--. 1 root root 541 Sep 3 2019 kexec.target -rw-r--r--. 1 root root 435 Sep 3 2019 local-fs-pre.target -rw-r--r--. 1 root root 547 Sep 3 2019 local-fs.target drwxr-xr-x. 2 root root 4096 May 18 2020 local-fs.target.wants -rw-r--r--. 1 root root 532 Sep 3 2019 multi-user.target drwxr-xr-x. 2 root root 4096 May 18 2020 multi-user.target.wants -rw-r--r--. 1 root root 505 Sep 3 2019 network-online.target -rw-r--r--. 1 root root 502 Sep 3 2019 network-pre.target -rw-r--r--. 1 root root 521 Sep 3 2019 network.target -rw-r--r--. 1 root root 554 Sep 3 2019 nss-lookup.target -rw-r--r--. 1 root root 513 Sep 3 2019 nss-user-lookup.target -rw-r--r--. 1 root root 394 Sep 3 2019 paths.target -rw-r--r--. 1 root root 592 Sep 3 2019 poweroff.target -rw-r--r--. 1 root root 417 Sep 3 2019 printer.target -rw-r--r--. 1 root root 583 Sep 3 2019 reboot.target -rw-r--r--. 1 root root 549 Sep 3 2019 remote-cryptsetup.target -rw-r--r--. 1 root root 436 Sep 3 2019 remote-fs-pre.target -rw-r--r--. 1 root root 522 Sep 3 2019 remote-fs.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 remote-fs.target.wants -rw-r--r--. 1 root root 492 Sep 3 2019 rescue.target drwxr-xr-x. 2 root root 4096 May 18 2020 rescue.target.wants -rw-r--r--. 1 root root 540 Sep 3 2019 rpcbind.target lrwxrwxrwx. 1 root root 15 Mar 24 2020 runlevel0.target -> poweroff.target lrwxrwxrwx. 1 root root 13 Mar 24 2020 runlevel1.target -> rescue.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel1.target.wants lrwxrwxrwx. 1 root root 17 Mar 24 2020 runlevel2.target -> multi-user.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel2.target.wants lrwxrwxrwx. 1 root root 17 Mar 24 2020 runlevel3.target -> multi-user.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel3.target.wants lrwxrwxrwx. 1 root root 17 Mar 24 2020 runlevel4.target -> multi-user.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel4.target.wants lrwxrwxrwx. 1 root root 16 Mar 24 2020 runlevel5.target -> graphical.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel5.target.wants lrwxrwxrwx. 1 root root 13 Mar 24 2020 runlevel6.target -> reboot.target -rw-r--r--. 1 root root 230 Oct 29 2019 selinux-autorelabel.target -rw-r--r--. 1 root root 442 Sep 3 2019 shutdown.target -rw-r--r--. 1 root root 402 Sep 3 2019 sigpwr.target -rw-r--r--. 1 root root 460 Sep 3 2019 sleep.target -rw-r--r--. 1 root root 449 Sep 3 2019 slices.target -rw-r--r--. 1 root root 420 Sep 3 2019 smartcard.target -rw-r--r--. 1 root root 396 Sep 3 2019 sockets.target drwxr-xr-x. 2 root root 4096 May 18 2020 sockets.target.wants -rw-r--r--. 1 root root 420 Sep 3 2019 sound.target -rw-r--r--. 1 root root 123 Mar 24 2020 sshd-keygen.target -rw-r--r--. 1 root root 503 Sep 3 2019 suspend.target -rw-r--r--. 1 root root 577 Sep 3 2019 suspend-then-hibernate.target -rw-r--r--. 1 root root 393 Sep 3 2019 swap.target -rw-r--r--. 1 root root 558 Sep 3 2019 sysinit.target drwxr-xr-x. 2 root root 4096 May 18 2020 sysinit.target.wants drwxr-xr-x. 2 root root 4096 Mar 24 2020 syslog.target.wants -rw-r--r--. 1 root root 543 Sep 3 2019 system-update-pre.target -rw-r--r--. 1 root root 617 Sep 3 2019 system-update.target drwxr-xr-x. 2 root root 4096 May 18 2020 system-update.target.wants -rw-r--r--. 1 root root 445 Sep 3 2019 timers.target drwxr-xr-x. 2 root root 4096 May 18 2020 timers.target.wants -rw-r--r--. 1 root root 426 Sep 3 2019 time-set.target -rw-r--r--. 1 root root 479 Sep 3 2019 time-sync.target -rw-r--r--. 1 root root 457 Sep 3 2019 umount.target ```   ### 参考资料 * https://blog.csdn.net/weixin_46654114/article/details/107126144 * https://blog.csdn.net/sinat_36888624/article/details/78544084   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [赋能学习] linux环境python3连接安全集群HDFS
    本文借鉴 https://blog.csdn.net/u012133034/article/details/100704082 实现说明:使用 hdfs 模块连接 webhdfs 接口实现1 环境系统:CentOS Linux release 7.6.1810 (Core)  3.10.0-957.el7.x86_64python编译器:Python 3.7.8  FusionInsight HD 版本:6.5.1 或者 8.0.2,其中dfs.http.policy配置为 HTTP_AND_HTTPS说明:(1)linux环境安装python3可参考 https://bbs.huaweicloud.com/forum/forum.php?mod=viewthread&tid=936822 步骤2.1 安装python依赖(1)因我的测试环境未连互联网,所有的依赖包是通过外网下载后上传到节点安装的,最终安装的python的依赖包如下:安装过程中使用的包:说明:(1)安装 cryptography 使用的是 cryptography-3.4.6-cp36-abi3-manylinux2010_x86_64.whl ,不要使用其tar.gz包来安装,否则需要依赖的东西太多,安装更麻烦(2)安装gssapi的时候,不能执行FI客户端的source,建议重新开个ssh终端来安装2.2 创建测试脚本脚本内容如下,其中IP为主Namenode节点IP,端口固定25002,注意修改对应的认证用户名import osfrom hdfs.ext.kerberos import KerberosClientfrom krbcontext import krbcontextclass HDFSTest:    def __init__(self, host, port):        self.keytab_file = os.path.split(os.path.realpath(__file__))[0] + '/user.keytab'        print(self.keytab_file)        self.user = 'developuser'        self._connect(host, port)    def _connect(self, host, port, sso_ticket=None):        try:            hdfs_url = 'http://' + host + ':' + port            active_str = 'kinit -kt {0} {1}'.format(self.keytab_file, self.user)            # 激活当前kerberos用户认证,因为python缓存机制,切换用户,这个缓存不会自动切换,需要手动处理下            os.system(active_str)            with krbcontext(using_keytab=True, keytab_file=self.keytab_file, principal=self.user):                self.client = KerberosClient(hdfs_url)        except Exception as e:            raise e    def test(self):        print(self.client.list("/"))        print(self.client._list_status("/tmp").json()["FileStatuses"]["FileStatus"])if __name__ == '__main__':    host = '8.5.136.6'    port = '25002'    a = HDFSTest(host, port)    a.test()2.3 执行测试脚本(1)将脚本中指定用户的认证票据文件user.keytab文件放到和该脚本同一级目录内(2)执行source 客户端bigdata_env(3)执行测试脚本  python3 huaweiHDFSTest.py
  • [其他问题] 在flink开发指南中,flinkkafkaexaple打包在linux上运行报错,报的错是:提取元数据时,kafka超时已过期
    【功能模块】【操作步骤&问题现象】1、2、【截图信息】【日志信息】(可选,上传日志内容或者附件)报错信息如下: The program finished with the following exception:org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 9e3c78adac04823062e5328231935728)        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:335)        at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:205)        at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:138)        at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:700)        at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:219)        at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:932)        at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1005)        at java.security.AccessController.doPrivileged(Native Method)        at javax.security.auth.Subject.doAs(Subject.java:422)        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1737)        at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)        at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1005)Caused by: java.util.concurrent.ExecutionException: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 9e3c78adac04823062e5328231935728)        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)        at org.apache.flink.streaming.api.environment.StreamContextEnvironment.execute(StreamContextEnvironment.java:83)        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1651)        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1633)        at com.huawei.bigdata.flink.examples.ReadFromKafka.main(ReadFromKafka.java:59)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:321)        ... 11 moreCaused by: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 9e3c78adac04823062e5328231935728)        at org.apache.flink.client.deployment.ClusterClientJobClientAdapter.lambda$null$6(ClusterClientJobClientAdapter.java:112)        at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)        at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)        at org.apache.flink.client.program.rest.RestClusterClient.lambda$pollResourceAsync$21(RestClusterClient.java:565)        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)        at org.apache.flink.runtime.concurrent.FutureUtils.lambda$retryOperationWithDelay$8(FutureUtils.java:291)        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)        at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:575)        at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:943)        at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)        at java.lang.Thread.run(Thread.java:748)Caused by: org.apache.flink.runtime.client.JobExecutionException: Job execution failed.        at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:147)        at org.apache.flink.client.deployment.ClusterClientJobClientAdapter.lambda$null$6(ClusterClientJobClientAdapter.java:110)        ... 19 moreCaused by: org.apache.flink.runtime.JobException: Recovery is suppressed by NoRestartBackoffTimeStrategy        at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.handleFailure(ExecutionFailureHandler.java:110)        at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.getFailureHandlingResult(ExecutionFailureHandler.java:76)        at org.apache.flink.runtime.scheduler.DefaultScheduler.handleTaskFailure(DefaultScheduler.java:192)        at org.apache.flink.runtime.scheduler.DefaultScheduler.maybeHandleTaskFailure(DefaultScheduler.java:186)        at org.apache.flink.runtime.scheduler.DefaultScheduler.updateTaskExecutionStateInternal(DefaultScheduler.java:180)        at org.apache.flink.runtime.scheduler.SchedulerBase.updateTaskExecutionState(SchedulerBase.java:484)        at org.apache.flink.runtime.jobmaster.JobMaster.updateTaskExecutionState(JobMaster.java:380)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcInvocation(AkkaRpcActor.java:279)        at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcMessage(AkkaRpcActor.java:194)        at org.apache.flink.runtime.rpc.akka.FencedAkkaRpcActor.handleRpcMessage(FencedAkkaRpcActor.java:74)        at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleMessage(AkkaRpcActor.java:152)        at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:26)        at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:21)        at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123)        at akka.japi.pf.UnitCaseStatement.applyOrElse(CaseStatements.scala:21)        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)        at akka.actor.Actor$class.aroundReceive(Actor.scala:517)        at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:225)        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:592)        at akka.actor.ActorCell.invoke(ActorCell.scala:561)        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:258)        at akka.dispatch.Mailbox.run(Mailbox.scala:225)        at akka.dispatch.Mailbox.exec(Mailbox.scala:235)        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)Caused by: org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata
  • [热门活动] 【我与华为云认证】我与华为云相识之路
    华为云最早的接触是在学校的红帽社团,因为我的专业是云计算所以我参加了与云计算有关的社团,恰巧社团中有些活动是华为云的,也是从此打开了我与华为云的相识之路我学的课程大致上是这样的,云导论、linux、网络基础、java、虚拟化等,这些课程主要是围绕了openstack和虚拟化以及docker,同时我也参加了一些大赛,但是在此之中我的linux老师是红帽认证持有者同时也跟华为的一些授权伙伴有联系(因为我的linux老师是红帽社团的指导老师,而老师对于华为的交换机数通这块无论是硬件还是技术都很认可,也参加过许多活动因此认识了一些伙伴),而恰好当时华为ICT的大赛开始报名我比较幸运的参加了,也是在那个时候第一次接触了华为的活动,也正是这次活动我对于华为云有了初步的认识。所以我除了学习了原生的openstack,我在空余时间也在华为云学院这里也会看一些活动和课程向大厂学习,也就是在这个过程中我参加了一部分的活动考取了微认证,我第一份工作在华为云授权的合作伙伴也是在这里考取了第一个职业认证HCIP-cloudservice(云服务),这个职业认证更多的是对于华为云云上的产品考察,通过这个考证可以很好地掌握云产品和大部分的云常识,而微认证就比较细节性的面向于某一领域的深挖性学习,大家可以根据个人喜好各取所需的去学习(职业认证和微认证都分为很多种,职业认证分三个等级难度是比较大的,我在2020年花钱培训学习了cloud computing的IP但是无奈遇到了疫情所以耽误了)。这些微认证或职业认证可以在写简历的时候可以作为一个证明,同时这些认证享有众多福利权限!1.证明你学习过这个板块的知识,你对该认证的理论与技能有一定的把握2.既然是华为云的职业认证或者是微认证,有华为云大厂的加持会比没有认证的同学更加具有一定的优势3.官方认证证书4.华为云产品优惠使用权优先享有5.华为云新产品的使用权6.沙箱实验室免费使用权7.华为全连接大会嘉宾名额优先享有权8.华为云面试推荐优先享有权9.成为华为云合作伙伴10.华为云云享专家11.认证专家线下交流会具体的有很多,这里就不详细的罗列啦,努力就会有收获的,冲鸭!在这里也有一点心得分享给大家,对于学习这件事情最好是有规划且要耐心坚持下去,因为信息技术计算机这个领域比较大,虽然很多的知识与技术是相互的(比如开发也分前后端)但最好还是有一个专精,懂得多虽然是一件好事但同时也要谨记切勿邯郸学步,希望大家可以多多关注我,以后我会在论坛上分享一些干货,欢迎大家来批评吐槽,希望能和大家一起进步!
  • [交流分享] linux yum 查看软件包和软件包组
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux yum 查看软件包和软件包组 #### 查看仓库及其状态 ``` bash # yum repolist all repo id repo name status EPOL EPOL enabled OS OS enabled debuginfo debuginfo enabled everything everything enabled source source enabled update update disabled ``` #### 查看yum的版本信息 ``` bash # yum info yum Last metadata expiration check: 2:21:15 ago on Tue 23 Mar 2021 07:59:26 PM CST. Installed Packages Name : yum Version : 4.2.15 Release : 8.oe1 Architecture : noarch Size : 4.0 Source : dnf-4.2.15-8.oe1.src.rpm Repository : @System From repo : anaconda Summary : Package manager URL : https://github.com/rpm-software-management/dnf License : GPLv2+ and GPLv2 and GPL Description : Utility that allows users to manage packages on their systems.\ : It supports RPMs, modules and comps groups & environments. ``` #### 查看已安装和未安装的软件包组 ``` bash # yum grouplist Last metadata expiration check: 2:21:55 ago on Tue 23 Mar 2021 07:59:26 PM CST. Available Environment Groups: Minimal Install Server Virtualization Host Available Groups: Container Management Development Tools Headless Management Legacy UNIX Compatibility Network Servers Scientific Support Security Tools System Tools Smart Card Support ``` ### 查看指定软件包组的信息 ``` bash # yum groupinfo Server Last metadata expiration check: 2:25:09 ago on Tue 23 Mar 2021 07:59:26 PM CST. Environment Group: Server Description: An integrated, easy-to-manage server. no group 'debugging' from environment 'server-product-environment' Mandatory Groups: Container Management Core Hardware Support Headless Management Server product core Standard Optional Groups: Basic Web Server DNS Name Server FTP Server File and Storage Server Hardware Monitoring Utilities Infiniband Support Mail Server Network File System Client Network Servers Performance Tools Remote Management for Linux Virtualization Hypervisor Windows File Server ```   ### 帮助文档(部分) ``` bash # yum --help usage: yum [options] COMMAND List of Main Commands: alias List or create command aliases autoremove remove all unneeded packages that were originally installed as dependencies check check for problems in the packagedb check-update check for available package upgrades clean remove cached data deplist List package's dependencies and what packages provide them distro-sync synchronize installed packages to the latest available versions downgrade Downgrade a package group display, or use, the groups information help display a helpful usage message history display, or use, the transaction history info display details about a package or group of packages install install a package or packages on your system list list a package or groups of packages makecache generate the metadata cache mark mark or unmark installed packages as installed by user. module Interact with Modules. provides find what package provides the given value reinstall reinstall a package remove remove a package or packages from your system repolist display the configured software repositories repoquery search for packages matching keyword repository-packages run commands on top of all packages in given repository search search package details for the given string shell run an interactive YUM shell swap run an interactive YUM mod for remove and install one spec updateinfo display advisories about packages upgrade upgrade a package or packages on your system upgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your system List of Plugin Commands: ...... ```   ### 参考资料 * https://blog.csdn.net/yaoshixian/article/details/86298705   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux rpm 查看已安装的软件包信息
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux rpm 查看已安装的软件包信息 #### 查看所有已经安装的软件包 ``` bash # rpm -qa tcpdump-4.9.3-3.oe1.x86_64 perl-ExtUtils-Install-2.14-419.oe1.noarch ncurses-base-6.1-14.oe1.noarch parted-3.3-2.oe1.x86_64 perl-Module-Load-0.32-418.oe1.noarch xkeyboard-config-2.24-6.oe1.noarch tar-1.30-11.oe1.x86_64 ...... ``` #### 查看已安装的软件包信息 ``` bash # rpm -qi dnf-4.2.15-8.oe1.noarch Name : dnf Version : 4.2.15 Release : 8.oe1 Architecture: noarch Install Date: Mon 18 May 2020 01:14:59 PM CST Group : Unspecified Size : 33740 License : GPLv2+ and GPLv2 and GPL Signature : RSA/SHA1, Tue 24 Mar 2020 03:47:22 AM CST, Key ID d557065eb25e7f66 Source RPM : dnf-4.2.15-8.oe1.src.rpm Build Date : Tue 24 Mar 2020 03:47:26 AM CST Build Host : obs-worker-100-0002.novalocal Packager : http://openeuler.org Vendor : http://openeuler.org URL : https://github.com/rpm-software-management/dnf Summary : A software package manager that manages packages on Linux distributions. Description : DNF is a software package manager that installs, updates, and removespackages on RPM-based Linux distributions. It automatically computes dependencies and determines the actions required to install packages.DNF also makes it easier to maintain groups of machines, eliminating the need to manually update each one using rpm. ``` #### 查看已安装软件包的配置文件 ``` bash # rpm -qc dnf-4.2.15-8.oe1.noarch /etc/dnf/automatic.conf /etc/dnf/dnf.conf /etc/dnf/protected.d/dnf.conf /etc/logrotate.d/dnf ``` #### 查看指定文件所属的软件包 ``` bash # rpm -qf /etc/dnf/automatic.conf dnf-4.2.15-8.oe1.noarch ``` #### 查看已安装软件包的依赖包 ``` bash # rpm -qR libarchive-3.4.1-2.oe1.x86_64 libacl.so.1()(64bit) libacl.so.1(ACL_1.0)(64bit) libbz2.so.1()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.15)(64bit) libc.so.6(GLIBC_2.16)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.6)(64bit) libc.so.6(GLIBC_2.7)(64bit) libcrypto.so.1.1()(64bit) libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) liblz4.so.1()(64bit) liblzma.so.5()(64bit) liblzma.so.5(XZ_5.0)(64bit) liblzma.so.5(XZ_5.2)(64bit) libxml2.so.2()(64bit) libxml2.so.2(LIBXML2_2.4.30)(64bit) libxml2.so.2(LIBXML2_2.5.0)(64bit) libxml2.so.2(LIBXML2_2.5.2)(64bit) libxml2.so.2(LIBXML2_2.6.0)(64bit) libxml2.so.2(LIBXML2_2.6.5)(64bit) libz.so.1()(64bit) libzstd.so.1()(64bit) rpmlib(CompressedFileNames) = 3.0.4-1 rpmlib(FileDigests) = 4.6.0-1 rpmlib(PayloadFilesHavePrefix) = 4.0-1 rpmlib(PayloadIsXz) = 5.2-1 rtld(GNU_HASH) ``` ### 帮助文档(部分) ``` bash # rpm --help Usage: rpm [OPTION...] Query/Verify package selection options: -a, --all query/verify all packages -f, --file query/verify package(s) owning file -g, --group query/verify package(s) in group -p, --package query/verify a package file --pkgid query/verify package(s) with package identifier --hdrid query/verify package(s) with header identifier --triggeredby query the package(s) triggered by the package --whatconflicts query/verify the package(s) which require a dependency --whatrequires query/verify the package(s) which require a dependency --whatobsoletes query/verify the package(s) which obsolete a dependency --whatprovides query/verify the package(s) which provide a dependency --whatrecommends query/verify the package(s) which recommends a dependency --whatsuggests query/verify the package(s) which suggests a dependency --whatsupplements query/verify the package(s) which supplements a dependency --whatenhances query/verify the package(s) which enhances a dependency --nomanifest do not process non-package files as manifests Query/Verify file selection options: -c, --configfiles only include configuration files -d, --docfiles only include documentation files -L, --licensefiles only include license files -A, --artifactfiles only include artifact files --noghost exclude %%ghost files --noconfig exclude %%config files --noartifact exclude %%artifact files Query options (with -q or --query): --dump dump basic file information ...... ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux os-release 查看系统信息
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### os-release 查看系统信息 ``` bash # cat /etc/os-release NAME="openEuler" VERSION="20.03 (LTS)" ID="openEuler" VERSION_ID="20.03" PRETTY_NAME="openEuler 20.03 (LTS)" ANSI_COLOR="0;31" ``` ``` bash # cat --help Usage: cat [OPTION]... [FILE]... Concatenate FILE(s) to standard output. With no FILE, or when FILE is -, read standard input. -A, --show-all equivalent to -vET -b, --number-nonblank number nonempty output lines, overrides -n -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank suppress repeated empty output lines -t equivalent to -vT -T, --show-tabs display TAB characters as ^I -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB --help display this help and exit --version output version information and exit Examples: cat f - g Output f's contents, then standard input, then g's contents. cat Copy standard input to standard output. GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Full documentation <https://www.gnu.org/software/coreutils/cat> or available locally via: info '(coreutils) cat invocation' ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [技术干货] Linux 中的多租户环境
    任何设置多租户环境的人都将面临是用虚拟机(VM)还是用容器来隔离环境的选择。如果使用虚拟机,虚拟机监控程序就会启动客户机,而每个客户机都有自己的操作系统及相应的应用和依赖项。同时,虚拟机监控程序还会确保用户之间彼此隔离。相比虚拟机,容器更加轻便、灵活且易于扩展。通过在单个主机上部署多个应用,并且使用内核和容器运行时来启动每个容器,容器可以简化多租户部署。与虚拟机(每个都包含自己的内核)相比,在容器中运行的应用则共享一个内核(甚至在多个租户之间)。在 Linux® 中,命名空间使得多个容器可以同时使用同一资源而不会产生冲突。确保容器的安全就等同于确保所有运行中进程的安全。 使用 Kubernetes 进行容器编排时,可以利用单个 Kubernetes 集群来设置多租户环境。您可以将租户分隔到自己的命名空间中,并创建能强制执行租户隔离的策略。
总条数:1200 到第
上滑加载中