debian8下pgsql的主备同步热切手动脚本
9以后,通过流复制直接做
主:192.168.1.111
从:192.168.1.222
需要在postgres帐号下先配置ssh互信,双机都配置
sh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@192.168.1.222
测试
ssh 192.168.1.222 date
sudo apt-get install rsync openssh-server
修改postgres的系统帐号和sql帐号的密码
创建一个用于流复制的用户账户repuser,密码123456
sudo -u postgres psql
create user repuser replication login password '';
\q退出
关于pg的操作最好全部在postgres这个帐号下
mkdir -p pg_ha_config
vim pg_hba.conf
local all postgres peer # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/ md5
# IPv6 local connections:
host all all ::/ md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/ md5
#host replication postgres ::/ md5
host replication repuser 0.0.0.0/0 md5
vim postgresql.conf
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
# values can be found in the PostgreSQL documentation.
#
# The commented-out settings shown in this file represent the default values.
# Re-commenting a setting is NOT sufficient to revert it to the default value;
# you need to reload the server.
#
# This file is read on server startup and when the server receives a SIGHUP
# signal. If you edit the file on a running system, you have to SIGHUP the
# server for the changes to take effect, or use "pg_ctl reload". Some
# parameters, which are marked below, require a server shutdown and restart to
# take effect.
#
# Any parameter can also be given as a command-line option to the server, e.g.,
# "postgres -c log_connections=on". Some parameters can be changed at run time
# with the "SET" SQL command.
#
# Memory units: kB = kilobytes Time units: ms = milliseconds
# MB = megabytes s = seconds
# GB = gigabytes min = minutes
# TB = terabytes h = hours
# d = days #------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------ # The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir. data_directory = '/var/lib/postgresql/9.4/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/9.4/main/pg_ident.conf' # ident configuration file
# (change requires restart) # If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/9.4-main.pid' # write an extra PID file
# (change requires restart) #------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------ # - Connection Settings - #listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = # (change requires restart)
max_connections = # (change requires restart)
# Note: Increasing max_connections costs ~ bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
# (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = # begin with to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart) # - Security and Authentication - #authentication_timeout = 1min # 1s-600s
ssl = true # (change requires restart)
#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
# (change requires restart)
#ssl_prefer_server_ciphers = on # (change requires restart)
#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
#password_encryption = on
#db_user_namespace = off # GSSAPI using Kerberos
#krb_server_keyfile = ''
#krb_caseins_users = off # - TCP Keepalives -
# see "man 7 tcp" for details #tcp_keepalives_idle = # TCP_KEEPIDLE, in seconds;
# selects the system default
#tcp_keepalives_interval = # TCP_KEEPINTVL, in seconds;
# selects the system default
#tcp_keepalives_count = # TCP_KEEPCNT;
# selects the system default #------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------ # - Memory - shared_buffers = 128MB # min 128kB
# (change requires restart)
#huge_pages = try # on, off, or try
# (change requires restart)
#temp_buffers = 8MB # min 800kB
#max_prepared_transactions = # zero disables the feature
# (change requires restart)
# Note: Increasing max_prepared_transactions costs ~ bytes of shared memory
# per transaction slot, plus lock space (see max_locks_per_transaction).
# It is not advisable to set max_prepared_transactions nonzero unless you
# actively intend to use prepared transactions.
#work_mem = 4MB # min 64kB
#maintenance_work_mem = 64MB # min 1MB
#autovacuum_work_mem = - # min 1MB, or - to use maintenance_work_mem
#max_stack_depth = 2MB # min 100kB
dynamic_shared_memory_type = posix # the default is the first option
# supported by the operating system:
# posix
# sysv
# windows
# mmap
# use none to disable dynamic shared memory # - Disk - #temp_file_limit = - # limits per-session temp file space
# in kB, or - for no limit # - Kernel Resource Usage - #max_files_per_process = # min
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart) # - Cost-Based Vacuum Delay - #vacuum_cost_delay = # - milliseconds
#vacuum_cost_page_hit = # - credits
#vacuum_cost_page_miss = # - credits
#vacuum_cost_page_dirty = # - credits
#vacuum_cost_limit = # - credits # - Background Writer - #bgwriter_delay = 200ms # -10000ms between rounds
#bgwriter_lru_maxpages = # - max buffers written/round
#bgwriter_lru_multiplier = 2.0 # -10.0 multipler on buffers scanned/round # - Asynchronous Behavior - #effective_io_concurrency = # -; disables prefetching
#max_worker_processes = #------------------------------------------------------------------------------
# WRITE AHEAD LOG
#------------------------------------------------------------------------------ # - Settings - #wal_level = minimal # minimal, archive, hot_standby, or logical
# (change requires restart)
#fsync = on # turns forced synchronization on or off
#synchronous_commit = on # synchronization level;
# off, local, remote_write, or on
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
# fdatasync (default on Linux)
# fsync
# fsync_writethrough
# open_sync
#full_page_writes = on # recover from partial page writes
#wal_log_hints = off # also do full page writes of non-critical updates
# (change requires restart)
#wal_buffers = - # min 32kB, - sets based on shared_buffers
# (change requires restart)
#wal_writer_delay = 200ms # - milliseconds #commit_delay = # range -, in microseconds
#commit_siblings = # range - # - Checkpoints - #checkpoint_segments = # in logfile segments, min , 16MB each
#checkpoint_timeout = 5min # range 30s-1h
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
#checkpoint_warning = 30s # disables # - Archiving - #archive_mode = off # allows archiving to be done
# (change requires restart)
#archive_command = '' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
#archive_timeout = # force a logfile segment switch after this
# number of seconds; disables #------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------ # - Sending Server(s) - # Set these on the master and on any standby that will send replication data. #max_wal_senders = # max number of walsender processes
# (change requires restart)
#wal_keep_segments = # in logfile segments, 16MB each; disables
#wal_sender_timeout = 60s # in milliseconds; disables #max_replication_slots = # max number of replication slots
# (change requires restart) # - Master Server - # These settings are ignored on a standby server. #synchronous_standby_names = '' # standby servers that provide sync rep
# comma-separated list of application_name
# from standby(s); '*' = all
#vacuum_defer_cleanup_age = # number of xacts by which cleanup is delayed # - Standby Servers - # These settings are ignored on a master server. #hot_standby = off # "on" allows queries during recovery
# (change requires restart)
#max_standby_archive_delay = 30s # max delay before canceling queries
# when reading WAL from archive;
# - allows indefinite delay
#max_standby_streaming_delay = 30s # max delay before canceling queries
# when reading streaming WAL;
# - allows indefinite delay
#wal_receiver_status_interval = 10s # send replies at least this often
# disables
#hot_standby_feedback = off # send info from standby to prevent
# query conflicts
#wal_receiver_timeout = 60s # time that receiver waits for
# communication from master
# in milliseconds; disables #------------------------------------------------------------------------------
# QUERY TUNING
#------------------------------------------------------------------------------ # - Planner Method Configuration - #enable_bitmapscan = on
#enable_hashagg = on
#enable_hashjoin = on
#enable_indexscan = on
#enable_indexonlyscan = on
#enable_material = on
#enable_mergejoin = on
#enable_nestloop = on
#enable_seqscan = on
#enable_sort = on
#enable_tidscan = on # - Planner Cost Constants - #seq_page_cost = 1.0 # measured on an arbitrary scale
#random_page_cost = 4.0 # same scale as above
#cpu_tuple_cost = 0.01 # same scale as above
#cpu_index_tuple_cost = 0.005 # same scale as above
#cpu_operator_cost = 0.0025 # same scale as above
#effective_cache_size = 4GB # - Genetic Query Optimizer - #geqo = on
#geqo_threshold =
#geqo_effort = # range -
#geqo_pool_size = # selects default based on effort
#geqo_generations = # selects default based on effort
#geqo_selection_bias = 2.0 # range 1.5-2.0
#geqo_seed = 0.0 # range 0.0-1.0 # - Other Planner Options - #default_statistics_target = # range -
#constraint_exclusion = partition # on, off, or partition
#cursor_tuple_fraction = 0.1 # range 0.0-1.0
#from_collapse_limit =
#join_collapse_limit = # disables collapsing of explicit
# JOIN clauses #------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------ # - Where to Log - #log_destination = 'stderr' # Valid values are combinations of
# stderr, csvlog, syslog, and eventlog,
# depending on platform. csvlog
# requires logging_collector to be on. # This is used when logging to stderr:
#logging_collector = off # Enable capturing of stderr and csvlog
# into log files. Required to be on for
# csvlogs.
# (change requires restart) # These are only used if logging_collector is on:
#log_directory = 'pg_log' # directory where log files are written,
# can be absolute or relative to PGDATA
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
# can include strftime() escapes
#log_file_mode = # creation mode for log files,
# begin with to use octal notation
#log_truncate_on_rotation = off # If on, an existing log file with the
# same name as the new log file will be
# truncated rather than appended to.
# But such truncation only occurs on
# time-driven rotation, not on restarts
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.
#log_rotation_age = 1d # Automatic rotation of logfiles will
# happen after that time. disables.
#log_rotation_size = 10MB # Automatic rotation of logfiles will
# happen after that much log output.
# disables. # These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres' # This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL' # - When to Log - #client_min_messages = notice # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# log
# notice
# warning
# error #log_min_messages = warning # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic #log_min_error_statement = error # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic (effectively off) #log_min_duration_statement = - # - is disabled, logs all statements
# and their durations, > logs only
# statements running at least this number
# of milliseconds # - What to Log - #debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = on
#log_checkpoints = off
#log_connections = off
#log_disconnections = off
#log_duration = off
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
log_line_prefix = '%t [%p-%l] %q%u@%d ' # special values:
# %a = application name
# %u = user name
# %d = database name
# %r = remote host and port
# %h = remote host
# %p = process ID
# %t = timestamp without milliseconds
# %m = timestamp with milliseconds
# %i = command tag
# %e = SQL state
# %c = session ID
# %l = session line number
# %s = session start timestamp
# %v = virtual transaction ID
# %x = transaction ID ( if none)
# %q = stop here in non-session
# processes
# %% = '%'
# e.g. '<%u%%%d> '
#log_lock_waits = off # log lock waits >= deadlock_timeout
#log_statement = 'none' # none, ddl, mod, all
#log_temp_files = - # log temporary files equal or larger
# than the specified size in kilobytes;
# - disables, logs all temp files
log_timezone = 'PRC' #------------------------------------------------------------------------------
# RUNTIME STATISTICS
#------------------------------------------------------------------------------ # - Query/Index Statistics Collector - #track_activities = on
#track_counts = on
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = # (change requires restart)
#update_process_title = on
stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp' # - Statistics Monitoring - #log_parser_stats = off
#log_planner_stats = off
#log_executor_stats = off
#log_statement_stats = off #------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------ #autovacuum = on # Enable autovacuum subprocess? 'on'
# requires track_counts to also be on.
#log_autovacuum_min_duration = - # - disables, logs all actions and
# their durations, > logs only
# actions running at least this number
# of milliseconds.
#autovacuum_max_workers = # max number of autovacuum subprocesses
# (change requires restart)
#autovacuum_naptime = 1min # time between autovacuum runs
#autovacuum_vacuum_threshold = # min number of row updates before
# vacuum
#autovacuum_analyze_threshold = # min number of row updates before
# analyze
#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
#autovacuum_freeze_max_age = # maximum XID age before forced vacuum
# (change requires restart)
#autovacuum_multixact_freeze_max_age = # maximum multixact age
# before forced vacuum
# (change requires restart)
#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
# autovacuum, in milliseconds;
# - means use vacuum_cost_delay
#autovacuum_vacuum_cost_limit = - # default vacuum cost limit for
# autovacuum, - means use
# vacuum_cost_limit #------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS
#------------------------------------------------------------------------------ # - Statement Behavior - #search_path = '"$user",public' # schema names
#default_tablespace = '' # a tablespace name, '' uses the default
#temp_tablespaces = '' # a list of tablespace names, '' uses
# only default tablespace
#check_function_bodies = on
#default_transaction_isolation = 'read committed'
#default_transaction_read_only = off
#default_transaction_deferrable = off
#session_replication_role = 'origin'
#statement_timeout = # in milliseconds, is disabled
#lock_timeout = # in milliseconds, is disabled
#vacuum_freeze_min_age =
#vacuum_freeze_table_age =
#vacuum_multixact_freeze_min_age =
#vacuum_multixact_freeze_table_age =
#bytea_output = 'hex' # hex, escape
#xmlbinary = 'base64'
#xmloption = 'content' # - Locale and Formatting - datestyle = 'iso, ymd'
#intervalstyle = 'postgres'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
# abbreviations. Currently, there are
# Default
# Australia (historical usage)
# India
# You can create your own file in
# share/timezonesets/.
#extra_float_digits = # min -, max
#client_encoding = sql_ascii # actually, defaults to database
# encoding # These settings are initialized by initdb, but they can be changed.
lc_messages = 'zh_CN.UTF-8' # locale for system error message
# strings
lc_monetary = 'zh_CN.UTF-8' # locale for monetary formatting
lc_numeric = 'zh_CN.UTF-8' # locale for number formatting
lc_time = 'zh_CN.UTF-8' # locale for time formatting # default configuration for text search
default_text_search_config = 'pg_catalog.simple' # - Other Defaults - #dynamic_library_path = '$libdir'
#local_preload_libraries = ''
#session_preload_libraries = '' #------------------------------------------------------------------------------
# LOCK MANAGEMENT
#------------------------------------------------------------------------------ #deadlock_timeout = 1s
#max_locks_per_transaction = # min
# (change requires restart)
# Note: Each lock table slot uses ~ bytes of shared memory, and there are
# max_locks_per_transaction * (max_connections + max_prepared_transactions)
# lock table slots.
#max_pred_locks_per_transaction = # min
# (change requires restart) #------------------------------------------------------------------------------
# VERSION/PLATFORM COMPATIBILITY
#------------------------------------------------------------------------------ # - Previous PostgreSQL Versions - #array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
#default_with_oids = off
#escape_string_warning = on
#lo_compat_privileges = off
#quote_all_identifiers = off
#sql_inheritance = on
#standard_conforming_strings = on
#synchronize_seqscans = on # - Other Platforms and Clients - #transform_null_equals = off #------------------------------------------------------------------------------
# ERROR HANDLING
#------------------------------------------------------------------------------ #exit_on_error = off # terminate session on any error?
#restart_after_crash = on # reinitialize after backend crash? #------------------------------------------------------------------------------
# CONFIG FILE INCLUDES
#------------------------------------------------------------------------------ # These options allow settings to be loaded from files other than the
# default postgresql.conf. #include_dir = 'conf.d' # include files ending in '.conf' from
# directory 'conf.d'
#include_if_exists = 'exists.conf' # include file only if it exists
#include = 'special.conf' # include file #------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------ # Add settings for extensions here
listen_addresses = '*'
wal_level = hot_standby
wal_keep_segments = 5000
max_wal_senders = 3 hot_standby = on
vim recovery.conf
standby_mode = on
primary_conninfo = 'host=192.168.1.222 user=repuser password=123456'
trigger_file = '/tmp/trigger_file'
vim init.sh
cp pg_hba.conf /etc/postgresql/9.4/main;
cp postgresql.conf /etc/postgresql/9.4/main;
vim start_as_master.sh
pg_ctlcluster -m fast 9.4 main stop;
rm /var/lib/postgresql/9.4/main/recovery.conf;
pg_ctlcluster -m fast 9.4 main start;
vim start_as_slave.sh
pg_ctlcluster -m fast 9.4 main stop;
rsync -ravztopg --progress --exclude=pg_xlog 192.168.1.222:/var/lib/postgresql/9.4/main/ /var/lib/postgresql/9.4/main/;
cp ./recovery.conf /var/lib/postgresql/9.4/main/;
pg_ctlcluster -m fast 9.4 main start;
vim stop.sh
pg_ctlcluster -m fast 9.4 main stop
*****************************************************************************
配置文件复制到从机rsync -r ~/pg_ha_config 192.168.1.222:/var/lib/postgresql/
复制以后需要修改的文件是recovery.conf和start_as_slave.sh脚本
里面的ip为master的ip
目前trigger_file还需要手工touch,全自动化工具,目前看来,需要用ruby脚本来粘合heartbeat和pgsql的trigger_file了
debian8下pgsql的主备同步热切手动脚本的更多相关文章
- LVS+MYCAT+读写分离+MYSQL主备同步部署手册
LVS+MYCAT+读写分离+MYSQL主备同步部署手册 1 配置MYSQL主备同步…. 2 1.1 测试环境… 2 1.2 配置主数据库… 2 1.2.1 ...
- 【转载】LVS+MYCAT+读写分离+MYSQL主备同步部署手册(邢锋)
LVS+MYCAT+读写分离+MYSQL主备同步部署手册 1 配置MYSQL主备同步…. 2 1.1 测试环境… 2 1.2 配置主数据库… 2 1.2.1 ...
- MySQL高可用(一)主备同步:MySQL是如何保证主备一致的
主备同步,也叫主从复制,是MySQL提供的一种高可用的解决方案,保证主备数据一致性的解决方案. 在生产环境中,会有很多不可控因素,例如数据库服务挂了.为了保证应用的高可用,数据库也必须要是高可用的. ...
- mysql 不停机 短时间锁表 备份 主备同步 新增备份机器
刷新数据 [root@localhost ~]# mysql -e 'flush tables with read lock;' 锁表刷新表数据 [root@localhost ~]# mys ...
- MySQL主备同步延迟
今天看到mycat的日志,发现在wrapper.log中频繁warning:slave延迟23006秒 查看数据指标: show engine innodb status正常,而且slave的拷贝点在 ...
- mysql主从(主备)同步一键配置,配自动检测功能
主从一键shell配置 做个笔记. #!/bin/bash #Mysql sync #chenglee #master机器ip MasterIP="192.168.137.174" ...
- MySQL学习(三)主备分库分表和恢复数据 --- 2019年2月
1.MySQL主备切换 readonly 设置对超级(super)权限是无效的,而用于同步更新的线程,就拥有超级权限. 建议在做主备数据库的时候,将备用数据库设置为只读.(反向用readonly来判断 ...
- MySQL高可用(二)主备延时如何解决?
从上篇文章我们知道主备同步是依赖于 binlog,主库负责生产 binlog,备库负责消费 binlog,从而实现主备同步. 今天我们来学习一下主备同步里的一个重点的问题:主备延时. 主备延时,简单来 ...
- mysql+mycat搭建稳定高可用集群,负载均衡,主备复制,读写分离
数据库性能优化普遍采用集群方式,oracle集群软硬件投入昂贵,今天花了一天时间搭建基于mysql的集群环境. 主要思路 简单说,实现mysql主备复制-->利用mycat实现负载均衡. 比较了 ...
随机推荐
- ngular6开发不完全笔记(二)-- 管道
自定义管道 管道(过滤器)为过滤数据显示下列list数据 pip.ts 文件 import { Pipe, PipeTransform } from '@angular/core'; import { ...
- OpenCV_火焰检测——完整代码
转:http://blog.csdn.net/xiao_lxl/article/details/43307993 火焰检测小程序 前几天,偶然看到了An Early Fire-Detection Me ...
- ZOJ 3391 Haunted Graveyard(最短路负权回路)题解
题意:好长...从(0,0)走到(w-1,h-1),墓碑不能走,走到传送门只能进去不能走到其他地方,经过传送门时间会变化w(可能为负),其他地方都能上下左右走.如果能无限返老还童输出Never,走不到 ...
- 往前端打smarty数据
$data['hot_issue']=$hotIssue; var_dump($data);
- R中的sample函数
今天介绍一些运算函数,它们的使用很简单,没有什么难度,但是也会用的着. 在医学统计学或者流行病学里的现场调查.样本选择经常会提到一个词:随机抽样.随机抽样是为了保证各比较组之间均衡性的一个很重要的方法 ...
- 在多节点上运行分布式Intel Caffe
一般有2种并行模式:数据并行(Data parallelism)和模型并行(model parallelism). 在模型并行化( model parallelism )方法里,分布式系统中的不同机器 ...
- 自行申请德国的VAT号码?
我在香港/大陆地区,是否可以自行申请德国的VAT号码? 德国联邦税务局按照不同国家申请人划分成不同申请办公室,以下为德国联邦税务局负责中国境内申请人的办公室地址及联络方式: FINANZAMT BER ...
- iTerm2的设置和Zsh.
很好的说明文: https://xiaozhou.net/learn-the-command-line-iterm-and-zsh-2017-06-23.html iTerm2是Mac os用户使用的 ...
- linux三尖刀
序 我们都知道,一个可执行程序的基本的生命过程是如此的: (编辑)源文件--->(编译)目标文件--->(链接)可执行文件--->(调试排错)稳定执行 所以,在这个过程中,我们很容易 ...
- UVA-12166 Equilibrium Mobile(二叉树)
题目大意:改变二叉树上的权值,使树平衡,问最少该几个值. 题目分析:不会做,查的题解.有条奇妙的性质:如果将第d层权值为w的节点为基准做改动,则整棵树的总重量为w<<d,即w*2^d.仔细 ...