dubbo_consumer依赖于dubbo_interface(依赖于common) war tomcat dubbo_provider(service,dao)依赖于dubbo_interface(依赖于common) war tomcat 五.Dubbo管理控制台 我们在开发时,需要知道Zookeeper注册中心都注册了哪些服务,有哪些消费者来消费这些服务。我们可以通过部署一个管理中心来实现。其实管理中心就是一个web应用,部署到tomcat即可。
目标
Dubbo管理控制台的使用(即Dubbo监控中心)
使用路径
安装(dubbo-admin.war) 使用(dubbo-admin.war)
5.1. 安装 下载dubbo-admin.war,放入Tomcat的webapps中
1 2
$ find ./apache-tomcat-8.5.54 -name "dubbo*war*" -type f ./apache-tomcat-8.5.54/webapps/dubbo-admin.war
启动Tomcat,此war文件会自动解压
1 2 3 4 5 6 7
$ ./apache-tomcat-8.5.54/bin/startup.sh Using CATALINA_BASE: /Users/swzxsyh/Program/apache-tomcat-8.5.54 Using CATALINA_HOME: /Users/swzxsyh/Program/apache-tomcat-8.5.54 Using CATALINA_TMPDIR: /Users/swzxsyh/Program/apache-tomcat-8.5.54/temp Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home Using CLASSPATH: /Users/swzxsyh/Program/apache-tomcat-8.5.54/bin/bootstrap.jar:/Users/swzxsyh/Program/apache-tomcat-8.5.54/bin/tomcat-juli.jar Tomcat started.
$ ./zkCli.sh /usr/bin/java 2020-06-16 17:13:31,750 [myid:] - INFO [main:ClientCnxn@1653] - zookeeper.request.timeout value is 0. feature enabled=
省略中间输出…
出现此行即说明连接成功
Welcome to ZooKeeper! 2020-06-16 17:13:31,757 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) JLine support is enabled 2020-06-16 17:13:31,834 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /127.0.0.1:64028, server: localhost/127.0.0.1:2181 [zk: localhost:2181(CONNECTING) 0] 2020-06-16 17:13:31,896 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1394] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x100014a6eed0000, negotiated timeout = 30000
依赖范围 对于编译classpath有效 对于测试classpath有效 对于运行classpath有效 例子 Compile(默认) Y Y Y Spring-core Test - Y - Junit Provided Y Y - servlet-api Runtime - Y Y JDBC驱动 System Y Y - 本地的,Maven仓库之外的类库 1.1.2 小结 Maven好处 安装配置Maven(熟练) 三种仓库(本地仓库(阿里镜像),中央仓库(远程仓库),私服(代理仓库)) 常见命令(clean compile test package install deploy) 坐标的书写规范(groupId artifactId version) 如何添加坐标(http://www.mvnrepository.com/) 依赖范围 私服的配置(settings.xml配置私服 工作中大概率要配置的) 1.2 Maven中jar包冲突问题 目标
1 2 3 4 5 6 7 8 9 10 [root@localhost ~]# ssh-keygen -t rsa <== 建立密钥对,-t代表类型,有RSA和DSA两种 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): #密钥文件默认存放位置,按Enter即可 Created directory ‘/root/.ssh’. Enter passphrase (empty for no passphrase): #输入密钥锁码 Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. #生成的私钥 Your public key has been saved in /root/.ssh/id_rsa.pub. #生成的公钥 The key fingerprint is: SHA256: ssh密钥配置
1 2 3 4 5 6 $ git checkout A “Algorithm/\347\256\227\346\263\225\345\233\276\350\247\243/.idea/$CACHE_FILE$” M C++ project/.vscode/launch.json M C++ project/.vscode/tasks.json M Java/MyFirstApp.class Your branch is up to date with ‘origin/master’. Master是条线,Git用master指向最新的提交,再用HEAD指向master,就能确定当前分支
每次提交,master分支都会向前移动一步,这样,随着你不断提交,master分支的线也越来越长。
1 2 3 Head ↓ A–>B–>C–>D–>E(Master) 创建新的分支,如dev,Git新建了一个指针叫dev,指向master相同的提交,再把HEAD指向dev,此时,对工作区的修改和提交就针对dev分支,提交后,dev指针往前移动一步,而master指针不变
1 2 $ git checkout -b dev Switched to a new branch “dev” 1 2 3 4 5 6 7 Master ↓ A–>B–>C–>D–>E ↘ dev ↑ Head dev上的工作完成了,就可以把dev合并到master上,删除dev分支,变回一条线
Copy a file to another location: cp path/to/file.ext path/to/copy.ext
Copy a file into another directory, keeping the filename: cp path/to/file.ext path/to/target_parent_directory
Recursively copy a directory’s contents to another location (if the destination exists, the directory is copied inside it): cp -r path/to/directory path/to/copy
Copy a directory recursively, in verbose mode (shows files as they are copied): cp -vr path/to/directory path/to/copy
Copy text files to another location, in interactive mode (prompts user before overwriting): cp -i *.txt path/to/target_directory
Dereference symbolic links before copying: cp -L link path/to/copy 删除
1 2 3 4 5 6 7 8 9 rmdir
Removes a directory.
Remove directory, provided it is empty. Use rm to remove not empty directories: rmdir path/to/directory
Vim (Vi IMproved), a command-line text editor, provides several modes for different kinds of text manipulation. Pressing i enters edit mode. <Esc> goes back to normal mode, which doesn’t allow regular text insertion. More information: https://www.vim.org.
Open a file: vim path/to/file
View Vim’s help manual: :help
Save a file: :write
Quit without saving: :quit!
Open a file at a specified line number: vim +line_number path/to/file
Undo the last operation: u
Search for a pattern in the file (press n/N to go to next/previous match): /search_pattern
Perform a regex substitution in the whole file: :%s/pattern/replacement/g 1.5 文件压缩命令 将文件打成压缩包
Archiving utility. Often combined with a compression method, such as gzip or bzip. More information: https://www.gnu.org/software/tar.
Create an archive from files: tar cf target.tar file1 file2 file3
Create a gzipped archive: tar czf target.tar.gz file1 file2 file3
Create a gzipped archive from a directory using relative paths: tar czf target.tar.gz -C path/to/directory .
Extract a (compressed) archive into the current directory: tar xf source.tar[.gz|.bz2|.xz]
Extract an archive into a target directory: tar xf source.tar -C directory
Create a compressed archive, using archive suffix to determine the compression program: tar caf target.tar.xz file1 file2 file3
List the contents of a tar file: tar tvf source.tar
Extract files matching a pattern: tar xf source.tar –wildcards “*.html”
Extract a specific file without preserving the folder structure: tar xf source.tar source.tar/path/to/extract –strip-components=depth_to_strip 解压缩包获得文件
Sends a signal to a process, usually related to stopping the process. All signals except for SIGKILL and SIGSTOP can be intercepted by the process to perform a clean exit.
Terminate a program using the default SIGTERM (terminate) signal: kill process_id
List available signal names (to be used without the SIG prefix): kill -l
Terminate a background job: kill %job_id
Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating: kill -1|HUP process_id
Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing Ctrl + C: kill -2|INT process_id
Signal the operating system to immediately terminate a program (which gets no chance to capture the signal): kill -9|KILL process_id
Signal the operating system to pause a program until a SIGCONT (“continue”) signal is received: kill -17|STOP process_id
Send a SIGUSR1 signal to all processes with the given GID (group id): kill -SIGUSR1 -group_id 搜索