关于在配置oracle11gr2rac时的4种IP,有不少朋友对此很迷惑,本文在此解说一下。打开一个RAC节点的/etc/hosts文件cat/etc/hosts#PublicIP192.168.1.138rac1.loca
关于在配置oracle 11gr2 rac时的4种IP,有不少朋友对此很迷惑,本文在此解说一下。
打开一个RAC节点的/etc/hosts文件
cat /etc/hosts
# Public IP
192.168.1.138rac1.localdomain rac1
192.168.1.139rac2.localdomain rac2
#Private IP
172.16.10.138rac1-priv.localdomain rac1-priv
172.16.10.139rac2-priv.localdomain rac2-priv
#Virtual IP
192.168.1.140 rac1-vip.localdomain rac1-vip
192.168.1.141 rac2-vip.localdomain rac2-vip
#SCAN IP
192.168.1.142 rac-scan.localdomain rac-scan
这个文件里设计四种IP,分别有Public IP、Private IP、Virtual IP、SCAN IP
private ip:即内部IP。用于节点间的通信,通信内容包括network heartbeat和cache fusion
public ip:即外部IP。用于提供对外数据服务。
Virtual IP:即虚拟IP。其最大作用是用于故障切换。
Oracle RAC中每个节点都有一个虚拟IP,,简称VIP, 与公网PUBLIC IP在同一个网段。vip 附属在public网口接口。
Virtual IP和PUBLIC IP最主要的不同之处在于:VIP是浮动的,而PUBLIC IP是固定的。在所有节点都正常运行时,每个节点的VIP会被分配到public NIC上;在linux下ifconfig查看,public网卡上是2个IP地址;如果一个节点宕机,这个节点的VIP会被转移到还在运行的节点上。也就是幸存的节点的public NIC这个网卡上,会有3个IP地址。
如果没有vip,连接失败节点的process会有一个比较长的tcp超时等待,才能返回错误,有了vip后,节点失效后,由于vip漂移到其它节点,连接该vip的process很快就能返回错误,从而更快的尝试连接其它活动的节点,避免客户端反复连接node1的实例。 如果应用程序和客户机都配置了透明的应用程序故障转移选项,可以在客户端重新连接到剩余的实例。
使用Virtual ip的另一个原因,我认为是负载均衡。客户端在配置tnsnames.ora时,有些场合是要使用的vip,而有些场合又必须使用Public IP。例如,当你在定位一个数据库的死锁时,使用Public IP,可以确保连到你想处理的机器。相反此时使用VIP时,会出现不确定性,因为服务器默认是开启负载均衡的,也就是有可能你想连A机,系统却给你分配了B机。
SCAN IP:在oracle 11gR2中,SCAN IP是作为一个新增IP出现的, scan ip其实是oracle在客户端与数据库之间,新加的一个连接层,当有客户端访问时,连接到 SCAN IP LISTENER, 而SCAN IP LISTENER接收到连接请求时,会根据 LBA 算法将该客户端的连接请求,转发给对应的instance上的VIP LISTENER,从而完成了整个客户端与服务器的连接过程。简化如下:
client -> scan listener -> local listener -> local instance
你也可以把scan理解为一个虚拟主机名,它对应的是整个RAC集群。客户端主机只需通过这个scan name即可访问数据库集群的任意节点。当然访问的节点是随机的,oracle强烈建议通过DNS Server的round robin模式配置解析SCAN,实现负载均衡(即轮换连接SCAN对应的IP地址)。这有点类似通过vip和listener loadbalance配置实现负载均衡的原理。
那么有了Virtual ip后为什么还增加了一个SCAN IP呢?
在oracle 11.2之前,client链接数据库的时候要用vip,假如你的oracle cluster有4个节点,那么客户端的tnsnames.ora中就对应有四个主机vip的一个连接串,如果cluster增加了一个节点,那么对于每个连接数据库的客户端都需要修改这个tnsnames.ora。
引入了scan以后,就方便了客户端连接的一个接口,顾名思义 single client access name ,简单客户端连接名,这是一个唯一的名称,在整个公司网络内部唯一,并且在DNS中可以解析为三个ip地址,客户端连接的时候只需要知道这个名称,并连接即可, 每个SCAN VIP对应一个scan listener,cluster内部的service在每个scan listener上都有注册,scan listener接受客户端的请求,并foward到不同的Local listener中去,还是由local 的listener提供服务给客户端。
scan ip主要是为了简化客户端连接,假如你的oracle 集群有20个节点,客户端连接的时候,是不是需要配置20个vip,如果用scan,只需要一个scan name就行了,剩下的事情,scan帮你做了。
本文出自 “滴水穿石孙杰” 博客,请务必保留此出处

Stored procedures are precompiled SQL statements in MySQL for improving performance and simplifying complex operations. 1. Improve performance: After the first compilation, subsequent calls do not need to be recompiled. 2. Improve security: Restrict data table access through permission control. 3. Simplify complex operations: combine multiple SQL statements to simplify application layer logic.

The working principle of MySQL query cache is to store the results of SELECT query, and when the same query is executed again, the cached results are directly returned. 1) Query cache improves database reading performance and finds cached results through hash values. 2) Simple configuration, set query_cache_type and query_cache_size in MySQL configuration file. 3) Use the SQL_NO_CACHE keyword to disable the cache of specific queries. 4) In high-frequency update environments, query cache may cause performance bottlenecks and needs to be optimized for use through monitoring and adjustment of parameters.

The reasons why MySQL is widely used in various projects include: 1. High performance and scalability, supporting multiple storage engines; 2. Easy to use and maintain, simple configuration and rich tools; 3. Rich ecosystem, attracting a large number of community and third-party tool support; 4. Cross-platform support, suitable for multiple operating systems.

The steps for upgrading MySQL database include: 1. Backup the database, 2. Stop the current MySQL service, 3. Install the new version of MySQL, 4. Start the new version of MySQL service, 5. Recover the database. Compatibility issues are required during the upgrade process, and advanced tools such as PerconaToolkit can be used for testing and optimization.

MySQL backup policies include logical backup, physical backup, incremental backup, replication-based backup, and cloud backup. 1. Logical backup uses mysqldump to export database structure and data, which is suitable for small databases and version migrations. 2. Physical backups are fast and comprehensive by copying data files, but require database consistency. 3. Incremental backup uses binary logging to record changes, which is suitable for large databases. 4. Replication-based backup reduces the impact on the production system by backing up from the server. 5. Cloud backups such as AmazonRDS provide automation solutions, but costs and control need to be considered. When selecting a policy, database size, downtime tolerance, recovery time, and recovery point goals should be considered.

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

Optimizing database schema design in MySQL can improve performance through the following steps: 1. Index optimization: Create indexes on common query columns, balancing the overhead of query and inserting updates. 2. Table structure optimization: Reduce data redundancy through normalization or anti-normalization and improve access efficiency. 3. Data type selection: Use appropriate data types, such as INT instead of VARCHAR, to reduce storage space. 4. Partitioning and sub-table: For large data volumes, use partitioning and sub-table to disperse data to improve query and maintenance efficiency.

TooptimizeMySQLperformance,followthesesteps:1)Implementproperindexingtospeedupqueries,2)UseEXPLAINtoanalyzeandoptimizequeryperformance,3)Adjustserverconfigurationsettingslikeinnodb_buffer_pool_sizeandmax_connections,4)Usepartitioningforlargetablestoi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
