Created
November 22, 2018 07:23
-
-
Save bbtdev/774ee3818e340f7a01b5653e803fb48e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
09:01 <za1b1tsu> Is it possible to have a shared database on a common partition between 2 OSes? Because I'm trying to achieve this and I can't start the postgres service after changing the data_directory to the shared one. | |
09:01 <za1b1tsu> It's version 9.6.10 | |
09:02 <RhodiumToad> 2 OSes that you are dual-booting? i.e. only one is running at a time? | |
09:02 --> held (~heldchen@unaffiliated/held) has joined #postgresql | |
09:02 <RhodiumToad> the answer is that it depends on the OSes | |
09:03 <peerce> if their libc implementations different significantly, it may not work. | |
09:03 <za1b1tsu> yes dual booting, one is Mac on is Linux, but right now I'm testing this on the VM. Sice I don't want to setup everything and then realize it doesnt work and have to start other. | |
09:04 <peerce> what error do you get when you try and start the 'other' OS that didn't create this ? | |
09:04 <za1b1tsu> the problem is the postgresql log in /var/log/... does not say much or I don't know how to interpret | |
09:04 <RhodiumToad> mac vs linux likely won't work unless you use C locale everywhere in the db - other locales will be incompatible | |
09:04 <peerce> often a different startup log gets created | |
09:05 <RhodiumToad> what does the log say? | |
09:05 <peerce> which OS created the database file system ? | |
09:05 <za1b1tsu> https://gist.github.com/bbtdev/a0207b508d8741702daa4a6b08642842 | |
09:05 <za1b1tsu> I don't think it logs the start sequence? | |
09:06 <RhodiumToad> yes it does | |
09:06 <za1b1tsu> The database was create on MacOSX | |
09:06 <peerce> anbd what flavor of linux is trying to start it ? | |
09:06 <RhodiumToad> and you're currently booted into linux and trying to start it? what linux distro? | |
09:06 <za1b1tsu> Ubuntu 18.10 in a VM | |
09:06 <za1b1tsu> Mojave bare-metal | |
09:06 --> grayhemp (~grayhemp@2601:646:8200:bf6a:e140:94a7:7d28:8fae) has joined #postgresql | |
09:07 <RhodiumToad> and pg_lsclusters shows what? | |
09:07 --> BeerLover ([email protected]) has joined #postgresql | |
09:07 <za1b1tsu> RhodiumToad: Ver Cluster Port Status Owner Data directory Log file | |
09:08 <RhodiumToad> how exactly were you trying to start pg? | |
09:08 <za1b1tsu> sudo service postgresql start | |
09:08 <za1b1tsu> I change back the data_dir it works | |
09:08 <RhodiumToad> where did you change it exactly? | |
09:09 <za1b1tsu> postgresql.conf and sudo -su postgres | |
09:09 <za1b1tsu> *as | |
09:09 <RhodiumToad> which postgresql.conf | |
09:09 <za1b1tsu> wait, maybe I need to shut it down on my Mac? | |
09:09 <peerce> oh, absolutely you have to shut it down | |
09:09 <za1b1tsu> /etc/postgresql/9.6/main/postgresql.conf | |
09:09 <peerce> but it should have complained it was already in use | |
09:09 <RhodiumToad> uh, you can't have two instances running in the same data directory at once, if you try that hilarity will ensue | |
09:09 --> pcav1 (~Thunderbi@2a02:a03f:5690:6000:a91d:c4fb:6eb1:de87) has joined #postgresql | |
09:10 <-- Guest1972 ([email protected]) has quit (Read error: Connection reset by peer) | |
09:10 <RhodiumToad> most likely you were saved from disaster by the new data dir not being accessible to the linux postgres user | |
09:10 <peerce> also, how is the VM mounting the macos data directory ? | |
09:10 <za1b1tsu> it's not working, stopped on macos, tried to start on ubuntu | |
09:11 --> daniel ([email protected]) has joined #postgresql | |
09:11 <za1b1tsu> peerce: it's through vagrant shared folder | |
09:11 -- daniel is now known as Guest40647 | |
09:11 <peerce> how does that handle user mappings? like, what user is postgres running as on macosx, who owns the files? | |
09:11 <peerce> is the linux vm using the same UID/GID for its postgres account ? | |
09:13 <za1b1tsu> ah, the files on the Mac are owned by 'bogdan', should I change the owner to postgres? | |
09:13 <za1b1tsu> UID/GID I don't know how to do this | |
09:14 <RhodiumToad> I think you should probably give up the idea | |
09:14 <RhodiumToad> do you have a good reason to want to do this? | |
09:14 <peerce> in linux, ls -n /path/to/mapped/data | |
09:14 <-- Guest40647 ([email protected]) has quit (Client Quit) | |
09:14 <RhodiumToad> I already pointed out that you'll have locale problems - by which I mean, unless you use C locale for all your databases and never override it, you'll get rampant index corruption | |
09:14 <peerce> yeah, the OS X C compiler and libc is just way different than gcc/glibc | |
09:15 <za1b1tsu> RhodiumToad: effiency, 265 ssd only. But I could live without it. | |
09:15 <za1b1tsu> it was a nice experiment | |
09:15 <za1b1tsu> but way above my technicall abilities | |
09:15 <peerce> dual booting IMHO sucks, run the 'other' OS as a VM, and have it connect to the host OS postgres server | |
09:15 --> chargen ([email protected]) has joined #postgresql | |
09:15 <-- held (~heldchen@unaffiliated/held) has quit (Ping timeout: 252 seconds) | |
09:15 <RhodiumToad> yeah, it's much easier to have the server running on one OS and connecting to it from the other one | |
09:16 <peerce> if the host OS is mac osx, configure it so the linux VM can connect to it | |
09:16 <peerce> then you can run postgres apps on linux which connect to the osx db server | |
09:17 <za1b1tsu> hmmm | |
09:18 <za1b1tsu> or I could run a postgresql server in a VM? | |
09:19 <za1b1tsu> and connect to it from the host | |
09:19 <peerce> yes, you could do that alternately, but then the VM would have to be running to access it from the host OS | |
09:19 <za1b1tsu> I could use something really light, like alpine linux | |
09:19 <peerce> if you're using it for sw devleopment or whatever, that may not be terribly convenient unless you keep the VM always on, eating resources | |
09:20 --> justanotheruser (~justanoth@unaffiliated/justanotheruser) has joined #postgresql | |
09:21 <za1b1tsu> anyway, thank you so much for the help and interest | |
09:21 --> EyePulp ([email protected]) has joined #postgresql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment