반응형

출처

https://serverfault.com/questions/914476/cant-access-mariadb-from-google-cloud-compute-instance


구글 클라우드 / Compute 인스턴스로부터 MariaDB에 접근할 수 없습니다.

저는 구글 클라우드 / Compute 인스턴스에서 실행하고 있는 Mysql에 원격 접근을 할 수 없는 거 같습니다. 저는 기본 설치를 시도하였습니다.

1. 저는 인스턴스를 기본값인 Debian을 사용하여 만들었습니다.

2. mysql을 apt-get install로 설치했고 설명하기 어렵지만 대신 MariaDB를 설치했습니다. 잘됩니다.

3. 저는 sudo mysql mysql_secure_installation을 prompt에 따라서 를 실행하였습니다. 설명하기 어렵지만 sudo를 사용하여 local 접근만 허용하기 위해 "root"를 위한 mysql.users 행을 "unix_socket"의 플러그인 열 값으로 나두었습니다.  잘 되었고 새로운 사용자를 추가하려고 합니다.

4. 저는 local에서 로그인하고 다음을 실행하였습니다.

create user 'myname'@'%' identified by 'mypass';

grant all privileges on * . * to 'mypass'@'%';

flush privileges;


저는 localhost에서 'myname'을 사용하여 접속할 수 있었습니다.

5. 저는 구글 클라우드 방화벽에서 8088 포트와 똑같은 규칙으로 만들었고 그 포트가 원격에서 잘 접속을 할 수 있었기 때문에 0.0.0.0/0으로 3306 포트를 열었습니다. 

6. 저는 원격에서 mysql을 접속했을 때 다음과 같은 내용을 얻었습니다.

이는 네트워크 문제일 수도 mysql 문제일 수도 있을 거 같은데 어느쪽인지 저는 모르겠습니다. 좋은 아이디어 있으신가요?

------

1개의 답변 중 1 개의 답변만 추려냄(자문자답)

알아내었습니다. /etc/mysql/maria.conf.d/50-server.cnf 설정 파일 깊은 곳에 뭍여 있었습니다. 그 파일에 놀라운 부분이 있었습니다.

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address        = 127.0.0.1

bind-address 부분을 주석처리 하니 잘 작동하였습니다.

이것은 MySql을 요청할 때 Debian으로 MariaDB를 설치하는 것은 예외적으로 나쁜 결정의 결과입니다. mysql*과 mariadb*라는 이름으로 복잡한 설정 파일들이 있는데 아무도 그 파일들이 하고자 하는 일을 하지 않습니다.

반응형
반응형

출처 

https://mariadb.com/kb/en/mariadb/memory-storage-engine/



MEMORY 저장 엔진

MEMORY Storage Engine


(이전엔 HEAP으로 알려진) MEMORY 저장 엔진의 내용은 디스크보다 메모리에 보관됩니다.


Contents of the MEMORY storage engine (previously known as HEAP) are stored in memory rather than on disk.


다른 테이블로부터 데이터의 읽기전용 캐쉬 즉 임시적인 작업 영역에서 사용하는 데 최고입니다.


It is best-used for read-only caches of data from other tables, or for temporary work areas.


데이터가 메모리에 보관되기 때문에 정전이나 하드웨어 고장에 매우 취약하며 영원히 데이터를 보관하는 데는 적절하지 않습니다. 사실, 서버가 재시작 하면 MEMORY 테이블은 (정의 파일이 디스크에 저장되기 때문에) 재생성 되지만 그 내용은 비어있을 것입니다. --init-file 서버 시작(startup) 옵션을 사용하여 쿼리로 원하는 내용을 다시 채울 수 있습니다.


Since the data is stored in memory, it is highly vulnerable to power outages or hardware failure, and is unsuitable for permanent data storage. In fact, after a server restart, MEMORY tables will be recreated (because the definition file is stored on disk), but they will be empty. It is possible to re-populate them with a query using the --init-file server startup option.


VARCHAR 같은 변수-길이 타입은 MEMORY 테이블에서 사용될 수 있습니다. BLOB 또는 TEXT 열(column)은 MEMORY 테이블에서 지원되지 않습니다.


 Variable-length types like VARCHAR can be used in MEMORY tables. BLOB or TEXT columns are not supported for MEMORY tables.


MEMORY 테이블의 최대 총 용량은 max_heap_table_size 시스템 서버 변수를 넘어설 수 없습니다. 테이블이 만들어질 때 이 값은 그 테이블에 적용하며, 서버가 재시작될 때 이 값은 현재 있는 테이블에 적용합니다. 이 값을 바꾸는 것은 현재 있는 테이블에는 효과가 없습니다. 하지만 ALTER TABLE ... ENGINE=MEMORY 문장의 실행은 그 테이블의 max_heap_table_size의 현재 값을 적용합니다. 또한 테이블을 만들기 전에 max_heap_table_size의 세션 값을 변경하는 것이 가능합니다.


 The maximum total size of MEMORY tables cannot exceed the max_heap_table_size system server variable. When a table is created this value applies to that table, and when the server is restarted this value applies to existing tables. Changing this value has no effect on existing tables. However, executing a ALTER TABLE ... ENGINE=MEMORY statement applies the current value ofmax_heap_table_size to the table. Also, it is possible to change the session value of max_heap_table_size before creating a table, to make sure that tables created by other sessions are not affected.


MAX_ROWS 테이블 옵션은 당신이 테이블에 저장할 행수에 관해 힌트를 제공합니다. 이 값은 초과할 수 없는 한계는 없지만, max_heap_table_size를 넘어설 수 없습니다. 저장 엔진은 테이블에 할당된 최대 메모리를 계산하는 데 max_heap_table_size와 MAX_ROWS를 사용합니다.


 The MAX_ROWS table option provides a hint about the number of rows you plan to store in them. This is not a hard limit that cannot be exceeded, and does not allow to exceed max_heap_table_size. The storage engine uses max_heap_table_size and MAX_ROWS to calculate the maximum memory that could be allocated for the table.


행이 삭제되었을 때 그 공간은 자동으로 해제되지 않습니다. 테이블을 없애지(drop) 않고 공간을 해제하는 유일한 방법은 ALTER TABLE tbl_name ENGINE = MEMORY 를 사용하는 것입니다. TRUNCATE TABLE도 메모리를 해제합니다.


 When rows are deleted, space is not automatically freed. The only way to free space without dropping the table is usingALTER TABLE tbl_name ENGINE = MEMORY

TRUNCATE TABLE frees the memory too.


인덱스 타입

Index type


MEMORY 저장 엔진은 B-tree 또는 Hash 인덱스를 허용합니다. 해시는 MEMORY에 대한 기본 타입 입니다. 보관 엔진 인덱스 타입을 보시면 더 많은 성질들을 확인할 수 있습니다.


The MEMORY storage engine permits indexes to be either B-tree or Hash. Hash is the default type for MEMORY. See Storage Engine index types for more on their characteristics.


MEMORY 테이블은 64개의 인덱스까지, 각 인덱스당 16개의 열(column)과 최대 키의 길이는 3072바이트까지 가질 수 있습니다.


A MEMORY table can have up to 64 indexes, 16 columns for each index and a maximum key length of 3072 bytes.

추가 보기

See also

 

 


예시

Example

다음 예시는 위에서 묘사된 주어진 최대 크기로 MEMORY 테이블을 만드는 방법을 보여줍니다.

The following example shows how to create a MEMORY table with a given maximum size, as described above.


반응형

'번역' 카테고리의 다른 글

테스트 주도 개발  (0) 2016.01.22
Computer virus  (0) 2009.10.07
악성코드  (0) 2009.10.07
BHO  (0) 2009.10.07
행성의 정의  (0) 2009.08.03

+ Recent posts